Amazon Interview Experience for SDE-1(On Campus)
Round 1 (Online Assessment 2hr 30min): The assessment consisted of four components, a code debugging section (20 minutes), a coding test (70 minutes), a work styles assessment (20 minutes), and a reasoning ability section (35 minutes).
Coding test questions:
- Given a number x, and a row-wise and column-wise sorted matrix, check if x exists in the matrix or not.
- Given a linked list, create a copy of that linked list and return a pointer to the head of the new linked list.
Round 2 (Online Interview 30 mins):
- A small discussion on trees and graphs
- Given a directed graph, check if it is a tree or not. Write complete clean code.
Round 3 (Online Interview 1 hr):
Interviewer: Select any one of your projects, we will then discuss it.
Did a detailed discussion on the project. The interviewer asked many technical details related to approach, implementation, results, etc, and non-technical questions like, “what was the most challenging part”. This took 30 minutes.
Design question: We have a system where logs are continuously being generated. Say, a few logs every minute. Each log will have a timestamp. Log type can be an error, info, etc. We are only interested in error logs. The error can be also of many types.
|Timestamp||log type||sublog type||noOfInstances|
At any time we want to fetch Error types and their number of instances in the last t minutes from the current time. The value of t depends on the query. In addition, you should be able to tell the error name with the highest number of instances in the last t minutes.
Interviewer, then further asked to tell the top k error name with the highest number of instances in the last t minutes.
Few more small questions like “how will you store data”, “how will you do this”, etc
Round 4(Online Interview 1 hr):
- Given a binary tree, Convert it to its mirror tree. I wrote a recursive function whose return type was void. The interviewer further asked to write one more solution, using a non-void return type function. Then a small discussion comparing both approaches, recursion-stack, worst and avg case time complexities, etc
- Given a BST, a node value, and an integer K. Print all nodes which are at distance K from the given node. Nodes at distance K from a node can be in all 3 directions. The left path, the right path, path via parent. The interviewer further asked to do the same question for the Binary tree.
I was able to answer all questions and write error-free clean code in one go. I got the offer 🙂