Tip 1 : Keep calm and DSA prepared
Tip 2 : Use gfg and leetcode for prep
Tip 3 : Do codeforces for CP
Tip 1 : Mention Education and Internship details precisely
Tip 2 : Projects and achievements should be well highlighted



Let’s say the array ‘A’ = [1, 3, 1, 5], then if we select index ‘2’, the sum of the prefix is ‘1’, and the sum of the suffix is 1 + 5 = 6. Since the sum is not the same, hence index ‘2’ is not a beautiful index.




1
5 2
9 6 3
13 10 7 4
14 11 8
15 12
16



For the given binary tree

The level order traversal will be {1,2,3,4,5,6,7}.
Create an empty queue q and push root in q.
Run While loop until q is not empty.
Initialize temp_node = q.front() and print temp_node->data.
Push temp_node’s children i.e. temp_node -> left then temp_node -> right to q
Pop front node from q.



Perform level order traversal on the tree
At every level print the last node of that level
You have 5 jars of pills. Each pill weighs 10 grams, except for contaminated pills contained in one jar, where each pill weighs 9 grams. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?
Step 1 : Take out 1 pill from jar 1, 2 pills from jar 2, 3 pills from jar 3, 4 pills from jar 4 and 5 pills from jar 5.
Step 2 : Put all these 15 pills on the scale. The correct weight is 150 (15*10). But one of the jars has contaminated pills. So the weight will definitely be less than 150.
Step 3 : If the weight is 149 then jar 1 has contaminated pills because there is only one contaminated pill. If the weight is 148 then jar 2, if the weight is 147 then jar 3, if 146 then jar 4, if 145 then jar 5



If edges[i][j] = 1, that implies there is a bi-directional edge between ‘i’ and ‘j’, that means there exists both edges from ‘i’ to ‘j’ and to ‘j’ to ‘i’.
Given:
‘N’ = 3
‘edges’ = [[0, 1, 1], [0, 0, 1], [0,0,0]].

To be able to split the node set {0, 1, 2, ..., (n-1)} into sets A and B, we will try to color nodes in set A with color A (i.e., value 1) and nodes in set B with color B (i.e., value -1), respectively.
If so, the graph is bipartite if and only if the two ends of each edge must have opposite colors. Therefore, we could just start with standard BFS to traverse the entire graph and
color neighbors with opposite color if not colored, yet;
ignore neighbors already colored with oppsite color;
annouce the graph can't be bipartite if any neighbor is already colored with the same color.
NOTE: The given graph might not be connected, so we will need to loop over all nodes before BFS.
Tell me about yourself.
Most difficult situation faced and how did you handle it ?

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?