Tip 1 : Practice at Atleast 250 Questions
Tip 2 : Ex- Do at least 2 projects
Tip 1 : Have some projects on resume.
Tip 2 : Do not put false things on resume.


A wormhole is a sort of tunnel that joins distant points in space, or even two universes, via space-time curvature. Theoretically, such a tunnel could be traversed from one point in space to another without actually travelling the distance between them.
1. Endpoints of all the wormholes are pairwise distinct.
It means if a wormhole starts or ends at the coordinate (x, y) then no other wormhole will start or end from the same coordinate. This holds true for the source and the destination coordinates as well.
2. If your path intersects with the wormhole, your spacecraft won't get sucked into the wormhole. As soon as you reach the entry/exit point of a wormhole you will come out from the exit/entry point( Wormholes are bi-directional).
I simply used recursion with the backtracking approach here and iterated over each wormhole and call recursion with that wormhole as starting point and calculated the minimum answer.





A binary search tree, also called an ordered or sorted binary tree, is a rooted binary tree whose internal nodes each store a key greater than all the keys in the node's left subtree and less than those in its right subtree.
For Example, the root node is given as follows :
‘ROOT’ = 6 4 3 -1 -1 5 -1 -1 8 7 -1 -1 9 -1 -1
Level 1 :
The root node of the tree is 6
Level 2 :
Left child of 6 = 4
Right child of 6 = 8
Level 3 :
Left child of 4 = 3
Right child of 4 = 5
Left child of 8 = 7
Right child of 8 = 9
Therefore all the leaf nodes are 3, 5, 7 and 9.



If the given array is [1,2,3] then the answer would be 2. One of the ways to make all the elements of the given array equal is by adding 1 to the array element with value 1 and subtracting 1 from the array element with value 3. So that final array would become [2,2,2].
I tried solving it using Dp approach but not able to pass test cases.



For sorting I explained the interviewer merge sort in linked list which divides the linked list into two halves and then merge them. wrote a fully commented code for him in good handwriting. I calculated mid point through slow and fast pointer approach as well.



a ⊕ b = X, where ⊕ denotes bitwise xor operation.
Both numbers ‘a’ and ‘b’ belong to the array ‘A’.
I explained him simple brute force approach through the loop but the interviewer was expecting a more efficient solution that I couldn‘t crack up.

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