Related Articles
Amazon Interview Experience | Set 352 (For SDE I)
• Difficulty Level : Hard
• Last Updated : 10 Jul, 2019

1) Online coding round of 45 minutes. We had a question where we had to read an unknown number of lines from a data file. Each line had a formatted date time stamp and a person’s name.
We were supposed to tell if some person had appeared twice on the same date or not. For C++, i used getline to take the input and then STL Map did the trick.

2) Onsite Face to Face Round 1
The interviewer asked me two questions and then I coded them after discussions:
He wanted to understand the logic behind the approach rather than just intuition. He asked for proof of the algorithm in the sense that why this works.

3) Onsite Face to Face Round 2

2. Then he asked me how to design a calculator. This involved discussions on exception handling etc.
3. He asked me about postfix and prefix expressions and how to use expression trees etc.
4. Edit distance

4) Onsite Face to Face Round 3

Rearrange characters in a string such that no two adjacent are same
He gave me input constraints of length of string as 10^5.
2. Then we discussed about detecting cycles in a graph. Can we use a BFS to detect a cycle in a directed graph? He asked me to code cycle detection for a directed graph.
You are given a binary 2 dimensional array, find the area of the largest rectangular submatrix which has 1s only.
He was not convinced with the my approach and asked me to give him test cases where this will fail. We made ten – fifteen cases and tested and it seemed to work.

5) Bar Raiser (Skype):

He wanted me to code a data structure for an auto-completing a search query. I mentioned Trie is a way and then we had discussions on Trie and search, insert etc in a Trie.
Then he asked me to code it using a Trie:

2. Then we discussed about databases. What are normal forms?
3. How will you design a database with books and authors (many to many relationship).
4. How do we query for the author with the maximum number of books?
5. What is a deadlock and what are ways to avoid it?
6. Give me a real life example of a deadlock.
7. Explain to me any single project in which you had to meet a deadline and what was your course of action?

There was one more round after this and that was the Bar Raiser actually. The 5th point mentioned in the initial post was just a technical interview.

1. He asked me why amazon?
2. Have i ever been in a situation where i went against my mentor in a project and what was the result?
3. How do i keep myself motivated during tough projects?