Interview Question

Software Developer Intern Interview

The questions were something on the lines of, - Given a

  tree, output levelwise nodes (Ans: It was actually the BFS algorithm, but I didn't realize it at that time) - Find first unique substring (In O(n)) (Ans: Use counting sort variant) - Convert an array into balanced binary search tree (Ans: First sort the array, then use recursive algorithm after splitting the array at mid, and using the mid as a node) - From two arrays N and M find the combinations that add up to say X (Ans: I was drained by the time second interview started, so the only answer I came up with was of O(n2) complexity i.e. using two FOR loops)
Answer

Add Answers or Comments

To comment on this review, Sign In with Facebook or Sign Up