Tip 1 : prepare company specific problems from internet
Tip 2 : Practice more and more
Tip 3 : Clear your basics properly
Tip 1 : Have some good skills
Tip 2 : Have some projects on resume.
Two coding questions will be there one easy for me and another one medium


Using some DSA algorithms



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 the height of the current element is the amount of water that can be stored in this array element.
Its technical round where they have given two problems



'K' must be less than or equal to the number of distinct elements in the given array.
Consider '0’ based indexing of the elements in the given array.
Print all indexes in increasing order.
If, 'ARR' = [4, 2, 4, 2, 1], and K = 2. Then output will be 0, 1, 2, 3.
I have solved first with time complexity o(n) then interviewer told me that solve it in less time then I have solved using method in which we are finding first mid then applying some cases



Input: Let the binary tree be:

Output: [10, 4, 2, 1, 3, 6]
Explanation: Consider the vertical lines in the figure. The top view contains the topmost node from each vertical line.
Logic I applied : First, I find the horizontal distance of all nodes then some little bit logic like the node with that horizontal distance present in hashmap then don't append
Its technical and behavioural round



You may assume that given ‘X’ and ‘Y’ definitely exist in the given binary tree.
For the given binary tree

LCA of ‘X’ and ‘Y’ is highlighted in yellow colour.
I did this using recursion
Its bar raiser round



1. There are no 2 adjacent elements having same value (as mentioned in the constraints).
2. Do not print anything, just return the index of the peak element (0 - indexed).
3. 'True'/'False' will be printed depending on whether your answer is correct or not.
Input: 'arr' = [1, 8, 1, 5, 3]
Output: 3
Explanation: There are two possible answers. Both 8 and 5 are peak elements, so the correct answers are their positions, 1 and 3.
I first applied brute force method. It was not good enough.
Interviewer asked me to optimise the solution.
Then I gave solution with binary search and interviewer was happy.
Its related to project experience like what difficulty you faced in these projects that you have mentioned in your resume

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?