Tip 1 : Practice questions on DS Algorithm ( array/string/DP/trees)
Tip 2 : Prepare SQL queries and normalization.
Tip 1 : Simple and clean
Tip 2 : Emphasize on internship
The width of each bar is the same and is equal to 1.
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].
Output: 10
Explanation: Refer to the image for better comprehension:
You don't need to print anything. It has already been taken care of. Just implement the given function.
The idea is to traverse every array element and find the highest bars on the left and right sides. Take the smaller of two heights. The difference between the smaller height and height of the current element is the amount of water that can be stored in this array element.
To make this efficient one must pre-compute the highest bar on the left and right of every bar in linear time. Then use these pre-computed values to find the amount of water in every array element.
Asked questions about stack queue LL and strings
Input:
2 4 5 -1
Output:
5 4 2 -1
Explanation: 2->4->5 is the initial linked list. If we reverse this, we get 5->4->2.
1) Divide the list in two parts - first node and
rest of the linked list.
2) Call reverse for the rest of the linked list.
3) Link rest to first.
4) Fix head pointer
How does paging works?
It was an easy round with some basic HR Questions.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you write a single-line comment in C++?