Tip 1 : Read interview experiences
Tip 2 : Solve 2-5 problems everyday
Tip 3 : Have faith
Tip 1 : Have at least 1-2 good projects, internships.
Tip 2 : Prepare a storyline based on your internship/job experience



I applied simple dfs on matrix.



Can you solve each query in O(logN) ?
I applied Modified binary search.



1. A ‘path’ is a sequence of adjacent pair nodes with an edge between them in the binary tree.
2. The ‘path’ doesn’t need to pass through the root.
3. The ‘path sum’ is the sum of the node’s data in that path.
Traverse tree and track max of right and left path sum from current node, and overall answer under current subtree.



Input: ‘n’ = 7, ‘prices’ = [100, 80, 60, 70, 60, 75, 85]
Output: [1, 1, 1, 2, 1, 4, 6]
Explanation:
On the sixth day, when the stock price was 75,
The span came out to be 4 because the last three prices(plus today) were less than the current or the sixth day's price.
Similarly, we can deduce the remaining results.
You don’t need to print anything. Just implement the given function



‘N’ = 3, ‘coins’ = {1, 2, 3}, ‘freq’ = {1, 1, 3}, ‘V’ = 6
For the given example, we can make six by using the following coins:
{1, 2, 3}
{3. 3}
Hence, the answer is 2.
Applied dp



For the given binary tree:

Subtree with the largest sum is highlighted in the above image. The sum is (-2 + 4 + 7) = 9



The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked list is 4 -> 3 -> 2 -> 1 -> NULL and the head of the reversed linked list will be 4.
Can you solve this problem in O(N) time and O(1) space complexity?
3 pointers technique.



[2,3,4] - median is 3.
[2,3] - median is floor((2+3)/2) = 2.
Used one min heap and one max heap.



Input:
3
3
4 6 8
3
2 5 7
2
1 9
Output:
1 2 4 5 6 7 8 9
Explanation:
First list is: 4 -> 6 -> 8 -> NULL
Second list is: 2 -> 5 -> 7 -> NULL
Third list is: 1 -> 9 -> NULL
The final list would be: 1 -> 2 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> NULL

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?