Open In App

Amazon Interview Experience for 6-Months SDE Internship

Improve
Improve
Like Article
Like
Save
Share
Report

Round 1 (Written Round): It consisted of mainly 4 sections.

  • Debugging Round: 7 codes to debug in 20 minutes
  • Coding Test: 2 coding questions in 70 mins
  • Personality Assessment: No time limit given (Ideally takes 15-20 mins)
  • Reasoning Ability Section: 24 questions in 35mins

In the coding section there were 2 questions:

  1. Given two sorted linked list. Merge them into one and return the head pointer.
  2. Find critical connections (Bridges) in a graph.

Those who cleared all the test cases in both questions were further selected for the Interviews. (37/200 cleared)

Round 2 (Technical Interview): It started with a formal introduction. The interviewer told that this round will last for an hour and 2 questions will be asked. So make sure to complete the code of each question within 30 minutes individually. A codeshare link was given for the writing code.

The interviewer was really friendly and was expecting the most optimized solution for the same. The interviewer also helped a lot in various approaches and was asking for edge cases for the approaches.

Question 1: Given, product ID and sales of the particular product, design a data structure to display the top N trending products by sales and also make a function to update the sales value.

Solution: Use a modified max-heap. Make the structure and implement the functions like maxHeapify, extractMax, increase/decrease key. In the max Heap, the array should be of pair<int, int> to store both product ID and sales.

Question 2: Implement locking in a binary tree. A binary tree node can be locked or unlocked only if all of its descendants or ancestors are not locked. For reaching the optimized solution, you are allowed to change the structure of the tree.

The interviewer helped in the process and gave 1-2 hints, which I could catch.

Link: https://www.dailycodingproblem.com/blog/lockable-binary-trees/

This round was not an elimination round and everyone proceeded for Round 3.

Round 3 (Technical Interview): The interviewer asked me to introduce myself and asked about the projects. A few cross-questioning followed and then the interviewer told that again 2 coding questions will be asked within the time span of 1 hour. Make sure to not exceed the time.

Question 1: Given a string and an integer k. A group of k identical characters is to be removed any number of times until it is no longer possible.

Solution: Used a stack and then kept on comparing the character to be added with the top of the stack (k times). Time Complexity: O(nk)

The interviewer asked for further optimization, used pair<char, int> in the stack to store the characters and its continuous occurrence.

(Link: https://www.geeksforgeeks.org/reduce-the-string-by-removing-k-consecutive-identical-characters/)

Question 2: Given a 2D grid, containing multiple people, open points, and blocked locations. A person can move in four directions (up, down, left, right). Find the min distance for each open point from its nearest person. If any open point is unreachable, store -1 in it.

Solution: Consider a queue and store the coordinates of each person in that queue. After that create a distance array of the same dimension (Initialized as INT_MAX). Apply BFS for each person and keep on finding the min value possible for all the points in the grid. The interviewer helped in arriving at this approach.

Finally, it was told that the interviews round are over and the results will be out soon.

Verdict: Selected 🙂 


Last Updated : 12 Oct, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads