Open In App

Amazon Interview Experience | SDE-1 (1-1.5 years experienced)

Improve
Improve
Like Article
Like
Save
Share
Report

First Try:

Round 1: Written test.

Q1. given a matrix of characters. find minimum steps to reach from ‘S’ to ‘D’ where ‘#’ is an obstacle.

Solution: BFS from ‘S’ to ‘D’.

Q2. print a binary tree vertically. link

Round 2: f2f interview.

Q1. given a binary tree print the nodes whose parent and grandparents sum is more than K.

Solution: pass GP and parent in recursion call.

Q2. modified the above question to print the nodes whose N parents sum is more than K.

Solution: recursion with a sum vector to calculate the sum in O(1) for any node.

Round 3: f2f interview.

Q1. given an Array print min and max of each subarray of size K.

Solution: DQ approach. link

he modified the question to find median as well.

Solution: 2 heaps approach link. he insisted on optimizing more by re-using the calculated data while finding min and max but I couldn’t.

Q2. given a Binary Tree and a pointer to one of its Node. at any point of time, this Node starts burning and the fire takes 1 second to reach an adjacent node. Print the nodes which will be burnt on each second separated by a newline.

Solution: find k distance nodes. link

I called such function while increasing the k value each time. he asked to do it in O(N) which I couldn’t.

later I thought I should have created a map of distance and nodes in a single function call.

I was called again next week.

Round 4: f2f interview. (this round was taken by mistake as they though It was my first round)

Q1. find the min replacements needed to convert string 1 to string 2.

Solution: DP approach.similar link

Q2. the next greater elements.

Solution: Stack approach. link

Round 5: f2f hiring manager.

Q1. design an elevator system.

Solution: I was more focused on writing code than designing interfaces for all components of the lift.

I’ll advise learning the way of answering such questions like class diagrams and then focus on design patterns.

Q2. median of a stream of numbers.

Solution: 2 heap approach.

Result: Rejected.

 

Second Try:

Round 1: Written test(solve 2/3)

Q1. find zeroes to be flipped so that number of consecutive 1s is maximized.  link

Q2. sort the array when an index x can only be swapped with x+k. if not possible return -1.

Q3. print the numbers having same digits, together. similar link

Round 2: f2f.

Q1. k most frequent strings in a book.

Solution: described Hash-Heap and Trie-Heap approach and was asked to code Hash one.

Q2. count number of subarrays having the sum equal to K.  link

Round 3: f2f.

Q1. search element in the row-wise, column-wise sorted matrix. link

Q2. Maximum path sum in BT. link

Round 4: f2f hiring manager.

Amazon Leadership principles.

Detailed discussion on my current Project.

Round 5: Online bar-raiser.

Amazon Leadership principles.

any project/task that I am most proud of.

Q: he shared a link to a 30-second youtube video. describing the amazon lockers system. where a delivery guy puts the package in locker. the customers scan the locker and get their package. design the schema and write an efficient algorithm to help find the appropriate locker for the delivery guy.

Solution:

Schema: lockers -> Racks -> Locations.

Algo: having queues for each locker size on every location.

Result: selected.


Last Updated : 09 Dec, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads