Amazon Interview Experience | On-Campus

Amazon visited our campus in the beginning of August. There was no eligibility criteria and 330 students approx sat for the online round.

Round 1 (Online):

It was an online coding round of two questions, and it really depends on your luck whether you’ll get an easy question or not (in my case they were easy, while some other candidates got lengthy DP questions).



  1. Given an expression in the form of a string “A+B=C”, where any two of A, B, and C were given, you had to find out the value of the third variable.
  2. Given a matrix, calculate the row with maxSum, and column with maxSum.

Around 50 students got through. This was followed by 4 technical F2F rounds, and they asked nothing from my resume, only Data Structures and Algorithms. Interviewers were friendly and kept giving adequate hints, they just want to see how well you can tackle a question.

Round 2:

  1. Given a n by n matrix, rotate each layer of the matrix by one element clockwise, so:  [ 1 2 3, 4 5 6,   7 8 9 ] should become [ 4  1  2, 7  5  3, 8  9  6 ]. This is to be done in constant space.
  2. Given a linked list, find Kth node from its end in one single traversal.
  3. Given a linux cd command like “a/b/c/./d/../e”, you have to find the resulting directory, or report error if any.

Round 3:

  1. Given a Binary Tree, convert it into a doubly linked list without using extra space.
  2. Given an array of strings, group all the anagrams together.

Round 4:

  1. Linearise a 2D linked list in one traversal and without using extra space. Each node would have a right and down pointers. The down pointer may or may not point to a non NULL node.
  2. Check whether two nodes in a Binary Tree are cousins or not in one single pass.
  3. Which sorting algorithm would be appropriate to sort a line of almirahs according to their height so that my effort is minimum. (Selection sort)

Round 5 (Final Round – Bar Raiser):

Around 16 students qualified till this round. Only one question was asked which would require the application of multiple data structures to solve.

  • Given an infinite stream of incoming strings with their timestamps, print a string only if it has not been printed in the last 10 seconds. A map based approach would not work because it can potentially grow to an infinite size with so many strings.
  • So, if the timestamp-string pairs were as follows:
    • 1 – foo
    • 3 – bar
    • 6 – foo
    • 11 – bar
    • 13 – foo
  • It would print: [ foo, bar, foo ] (foo at timestamp 6 was not printed as foo was already received within 10 seconds in the past)
  • This solution required the combination of both map and a deque.

I was rejected after the Bar Raiser, because my round 2 did not go very well. I could not propose a space optimized solution for the Binary Tree question. Your scores across all of the rounds will finally be added up.

Whatever solution you propose, you should try to optimize it as much as you can. And keep your fundamentals of DSA very strong as all Amazon wants in a candidate, is a very good aptitude for coding. And whatever happens is for the best, so don’t take rejection in any round very hard, immediately shift your focus toward the next company. You can cry all you want after you get placed. 😛

Best of luck.

 

Write your Interview Experience or mail it to contribute@geeksforgeeks.org



My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.