Tip 1 : Focus on DSA-practice.
Tip 2 : Prepare CS fundamentals.
Tip 3 : Do at least two development projects.
Tip 1 : Try to follow a basic format and highlight important achievements.
Tip 2 : Mention at least two good projects.



Input: 'arr' = [1, 2, 7, -4, 3, 2, -10, 9, 1]
Output: 11
Explanation: The subarray yielding the maximum sum is [1, 2, 7, -4, 3, 2].
To solve this, I applied Kadane's algorithm, where you keep two variables: one stores the maximum sum of the contiguous subarray ending at the current index, and the other stores the maximum sum of the contiguous subarray found so far.



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.
Iterate over every elevation or element and find the maximum elevation to the left and right of it. For example, the maximum elevation to the left of the current elevation or element that we are examining is ‘maxLeftHeight,’ and the maximum elevation to the right of it is ‘maxRightHeight.’ Take the minimum of ‘maxLeftHeight’ and ‘maxRightHeight’ and subtract it from the current elevation or element. This will be the amount of water that can be stored at this elevation. Compute the amount of water that each elevation can store and sum them up to return the total units of water that can be stored.




For the given binary tree: the LCA of (7,8,10) is 1
All of the node values of the binary tree will be unique.
N1, N2, and N3 will always exist in the binary tree.
It was a standard question, so, it was easy to solve.



If the given grid is this:
[7, 19, 3]
[4, 21, 0]
Then the modified grid will be:
[7, 19, 0]
[0, 0, 0]
In this first approach, I suggested storing which columns and rows have zeroes in a separate matrix and then running a loop again to make rows and columns containing zeroes into zeroes. The interviewer asked me to optimize this by reducing the space complexity. So, the approach I proposed was to store a zero at the 0th index of every column and row if any zeroes exist in that column or row.

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?