Written Test (on Hackerrank)
20 MCQ’s and 2 Coding Questions to be solved in 90 minutes
1) NEXT PERMUTATION: Next Largest Number with same set of digits.
For Ex: I/P: 123, O/P: 132
2) DFS + DP Standard Question. I don’t remember the exact problem statement, but it was pretty standard one and required a DFS+DP solution.
2) Given only a Node of a Binary Tree, Find the next in-order successor in O(1) space. Root of tree is unknown.
As he told to assume anything except the position of root, To solve the problem I assumed that the Treenodes also contain parent pointers to their respective parent.
2) Variation of above question, you are not allowed to use Hashmap. Discussed many approaches. He applied a constraint of not using any Hashing, after a lot of discussion and variations came up with the solution as a Doubly Linked List of List of Nodes. Since I was not allowed to use hashing, the variation I did to solve was to maintain a global pointer to the doubly linked list, moved it left in doubly linked list for the left child of current treenode and move right for right child of current tree-node.
Round Three (F2F)
Introduction and Internship related discussion followed by these technical problems
1) Given a Stream of sorted integers. Size of input vector is unknown. Find a given integer. Expected Complexity; Log(n)
Hint: Used Perfect Square’s as the start index and end index in binary search approach.
2) Variation in above problem, as we do not know the end point. Lets assume we have a function which returns NULL if the threshold index (Size of input vector)
had crossed. Now improve above solution to handle the case.
Ex: Lets assume that the array size is
3) Subject Related Questions: TCP v/s UDP, Virtual memory, Cryptography etc
4) Design a Music Player which plays songs in random order without repeat. Came with O(n) Time and O(1) space solution.
Round Four (F2F)
Introduction, Project related questions followed by:
1) Given k sorted Linked Lists. combine those into one sorted list.
Used custom Min heap approach to do the same.
2) Implement Custom Min Heap for above problem.
3) Print Nodes at distance “k” from a given node in a binary tree.
Round Five (Telephonic)
1) Introduction and Project discussion.
2) Convert given integer into Roman Number format but by using minimum number of conditional statements. Came up with lot of approaches,
he was not satisfied with any approach and asked to remove as much conditional statements as I can.
3) Given an array of zeroes and ones. find the maximum size of subarray with equal number of zeroes and ones. Came up with O(n) time and O(n) space solution.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Amazon Interview Experience Offcampus for SDE-1
- Amazon Interview Experience | SDE-1 offcampus
- Amazon interview Experience | Set 141 (For SDE1)
- Amazon Interview Experience | Set 185 (For SDE1)
- Amazon Interview Experience | Set 262 (For SDE1)
- Amazon Interview Experience | Set 186 (For SDE1)
- Amazon Interview Experience | Set 187 (For SDE1)
- Amazon Interview Experience | Set 188 (For SDE1)
- Amazon Interview Experience | Set 281 (for SDE1)
- Amazon Interview Experience SDE1
- Amazon Interview Experience | 198 (For SDE1)
- Amazon Interview Experience | Set 261 (For SDE1)
- Amazon Interview Experience for SDE1
- Amazon Interview Experience | Set 153 (For SDE1)
- Amazon Interview Experience | Set 258 (For SDE1)