Tip 1: Practice at least 250 Questions
Tip 2: Also focus on Core CSE subjects from the interview point of view.
Tip 1: Have some projects on resume.
Tip 2: Highlight job specific skills.



For 'arr' = [ 1, 2, 3, 1, 2]. you need to return 1.
This is a very simple & straightforward question. I stored all the frequencies of elements in an unordered hashmap & then iterated over the map & returned the key of the map with highest value of frequency.



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].
I began with the question with normal brute-force , i.e. I calculated the sum of all subarrays & returned the maximum out of them. To my suprise , the constraints were so weak that the O(n2) approach worked for all test cases & I didn't go for the Kadane's Algorithm which is based on O(n) time complexity.







All the possible root to leaf paths are:
3, 4, -2, 4 with sum 9
5, 3, 4 with sum 12
6, 3, 4 with sum 13
Here, the maximum sum is 13. Thus, the output path will be 6, 3, 4.
There will be only 1 path with max sum.
I applied DFS with memorization and it was optimized approach with O(n) time complexity.



The graph has no self-edges, no parallel edges.
The graph may not be connected.
A graph is bipartite if the nodes of the graph can be partitioned into two independent sets A and B such that every edge in the graph connects a node in set A and a node in set B.
If ‘N’ = 4, ‘M’ = 5, edgeList = [ [0, 1],[0, 3],[1, 2] ].

Here, you can see that the graph is bipartite as we can divide the nodes in two sets as follows:
setA = [0, 2].
setB = [1, 3].
In the graph, you can see that every edge in the graph connects a node in set A and a node in set B.
Hence, the output is “Yes”.

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