Tip 1: Consistency is key.
Tip 2: Revise concepts at least two to three times a week.
Tip 3: Practice DSA and basic system design concepts.
Tip 1: Build good projects.
Tip 2: Mention measurable achievements in your resume, such as improvements reflected in numbers. Also, include your competitive programming platform rating, as it can create a strong impact.



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].
So basically, I applied Kadane’s algorithm to solve this problem; there were slight modifications.



Merge Sort Algorithm -
Merge sort is a Divide and Conquer based Algorithm. It divides the input array into two-parts, until the size of the input array is not ‘1’. In the return part, it will merge two sorted arrays a return a whole merged sorted array.

The above illustrates shows how merge sort works.
It is compulsory to use the ‘Merge Sort’ algorithm.
I knew merge sort and I wrote it , it was pretty straight forward problem.



1. A node will be in the bottom-view if it is the bottom-most node at its horizontal distance from the root.
2. The horizontal distance of the root from itself is 0. The horizontal distance of the right child of the root node is 1 and the horizontal distance of the left child of the root node is -1.
3. The horizontal distance of node 'n' from root = horizontal distance of its parent from root + 1, if node 'n' is the right child of its parent.
4. The horizontal distance of node 'n' from root = horizontal distance of its parent from the root - 1, if node 'n' is the left child of its parent.
5. If more than one node is at the same horizontal distance and is the bottom-most node for that horizontal distance, including the one which is more towards the right.
Input: Consider the given Binary Tree:

Output: 4 2 6 3 7
Explanation:
Below is the bottom view of the binary tree.

1 is the root node, so its horizontal distance = 0.
Since 2 lies to the left of 0, its horizontal distance = 0-1= -1
3 lies to the right of 0, its horizontal distance = 0+1 = 1
Similarly, horizontal distance of 4 = Horizontal distance of 2 - 1= -1-1=-2
Horizontal distance of 5 = Horizontal distance of 2 + 1= -1+1 = 0
Horizontal distance of 6 = 1-1 =0
Horizontal distance of 7 = 1+1 = 2
The bottom-most node at a horizontal distance of -2 is 4.
The bottom-most node at a horizontal distance of -1 is 2.
The bottom-most node at a horizontal distance of 0 is 5 and 6. However, 6 is more towards the right, so 6 is included.
The bottom-most node at a horizontal distance of 1 is 3.
The bottom-most node at a horizontal distance of 2 is 7.
Hence, the bottom view would be 4 2 6 3 7
To solve this problem, I used a queue of pairs to perform a level-order traversal of the binary tree. The queue helped me process nodes in BFS order. In each pair, one value represented the node, and the other represented the horizontal distance from the root.
I started by assigning the root node a horizontal distance of 0. Whenever I moved to the left child, I decreased the horizontal distance by 1, and when I moved to the right child, I increased it by 1. While traversing the tree, I kept updating the value corresponding to each horizontal distance. Since BFS processes nodes level by level, the last node encountered at a particular horizontal distance represents the bottom view for that position.



V is the number of vertices present in graph G and vertices are numbered from 0 to V-1.
E is the number of edges present in graph G.
The Graph may not be connected i.e there may exist multiple components in a graph.
Basically, this problem can be solved using either BFS or DFS.



If the input string is "abbc", then all the possible palindromic substrings would be: ["a", "b", "b", c", "bb"] and hence, the output will be 5 since we have 5 substrings in total which form a palindrome.
A string is said to be a 'Palindrome' if it is read the same forwards and backwards.
For example, “abba” is a palindrome, but “abbc” is not.
A 'Substring' is a contiguous sequence of characters within a string.
For example, "a", "b", "c", "ab", "bc", "abc" are substrings of "abc".
Use dynamic programming by checking every substring. A substring is a palindrome if its first and last characters match and the inner substring is also a palindrome. Build results for shorter substrings first.
Prove the time complexity of Merge Sort.
I explained, using an example, how we get the average time complexity as (O(n \log n)).
Basic HR questions included why I wanted to join Nagarro, what my next 5-year goals are, and what kind of projects Nagarro is working on.
Tip 1: Prepare for basic HR questions.
Tip 2: Read about the company and its current projects.
Tip 3: Stay calm and confident during the HR round.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?