Round 1(online) :
Consisted of 5 sections:
1) 10 debugging questions
2) 2 coding ques :- i) https://www.geeksforgeeks.org/search-in-row-wise-and-column-wise-sorted-matrix/
3) Personality questions
4) Logical Reasoning questions
Round 2(Technical 1) – remotely :
1) Introduced myself
2) 2 coding questions were asked
Basically you have to find operations to change each non-negative element to 1 & negative element to -1. Count the operations for each element by taking absolute diff. If count of negative numbers is odd and no zeros are there then increase the operations by 2.
ii) In a binary tree, find a path between 2 nodes. There was a modification that the height of the tree is infinite and the tree is not in memory.
The structure of tree is like :- 1
4 5 6 7….. We are given 2 long ints as inputs and we return a vector which is path between them.
I discussed with him to go from “node to root” instead of general “root to node”. He asked me how and I found out LCA using map and stack.
He said the approach is right but he does not want to use map/stack or any derived DS. Use only primitive DS. Solved it using arrays. I gave a case where the map-stack approach would be more optimized. So he told me to analyze both the approaches w.r.t. time and space and explain why it is so.
Time and space for both approaches were O(log(n)) for the worst case. For average cases and in runtime map-stack would be more optimized and he agreed on it. He asked me to code any of the 2 approaches. I coded the array one as it was simpler to implement. Then he asked if I had any ques and concluded the interview.
Round 3(Technical 2) – remotely :
No intro, no small talk, straight to coding
No constraints on k & N and was told to handle all possible corner cases.
Discussed approach -> coded it -> approved -> discussed time complexity and why it is O(n)
Explained approach -> she asked which traversal will be used and why -> postorder as we calculate left and right child first and then process root -> coded it -> approved
Gave the solution with 2 arrays i.e. left-max & right-max. She told me to do it in a single extra array. Did after taking 5 mins. Then she told me to do it in constant space.
I didn’t think that was even possible. After trying for 10-12 mins I told her I am getting nowhere. She told me to code the single-array approach.
Coded it -> had some logical mistakes -> she gave a direction what the error can be and did a dry run together -> solved it after some time and code was approved.
She told me we have some time to think about how to do it in constant space. 10 mins later, the time was up I did not come up with anything and the Interview was over,
NO projects, subjects, HR questions
Verdict :- Selected
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.