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
For...
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 contamin...
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
...
Tell me about yourself.
Most difficult situation faced and how did you handle it ?