This was a pool campus conducted by amazon for internship.
Online Round: There were 20 mcq(+1 for each) and 2 coding questions(+30 for each). MCQ had more networking and DS problems.
- Given three linked list, add them. GeeksforGeeks Link
Input will be of this format
1->0->1 8->9->9 5 Output: 1->0->0->5
Solving above problem in python is easier than C++. I solved it in C++ using deque(30/30 points). - Given an array of size n consisting of positive integers, choose three integers(not necessarily contiguous) such that they are in ascending order and their product is maximum. Input was given in this format.
array = {5, 3, 6, 8, 9, 10} Output: array = {8, 9, 10}Many people(including me) ignored the ascending order part and got 20/30 points. Later during interview, interviewer asked me to explain my code and told me the corner case.
Note: Input was given exactly like I said in both problems. It was a bit different from usual problems. You first have to break strings to integers then solve the problem.
- Tic-Tac-Toe This was on paper round. I have heard there is another easier solution using magic square. 8 were selected from this round.
- Level order traversal
- Find next greater number with same set of digits Instead of digits, it was string of alphabets. There was a bug in my code. Interviewer gave me a test case and asked me to test it. Changed the approach and solved it by sorting. He asked which sorting and why? First I said merge sort because of nlogn complexity. Then I said since range is small(1-26), we can use count sort. He asked if we really need sorting? Then I said that reversing the second part was sufficient because it was in descending order.