Panda Guru LogoPanda
Guru

Amazon | SDE2 | Bangalore (India) | 2024 [Offer]

OA

Questions: Two questions (Medium/Hard), don’t remember exact questions. All test cases were passing in both problems. Some scenarios and questions for tech decisions, and lots of behavioral questions.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.


Round 1: DSA

Questions:

  1. You have given 2n + 1 numbers. Each number has its pair except one number. Every pair of numbers are adjacent. You need to find that number who does not have its pair.

  2. You are given a binary tree.

    • a. You need to remove leaf nodes one by one and print the leaf nodes one by one. You can remove leaf nodes in any order.
    • b. Remove a leaf node and after removing that node if its parent became a leaf node, remove that node first and so on.
    • c. Remove all leaf nodes first then remove all new leaf nodes and so on.
Candidate's Approach

I had optimal solutions in all cases. For question 1, I used binary search; for question 2a, I implemented DFS, which also works for 2b. For 2c, I used DFS as well but slightly different, maintaining the current level and using vector<vector<int>> for the return type.

Interviewer's Feedback

No feedback provided.


Round 2: LLD

Questions: Implement Amazon Locker. It’s a service where users can choose a locker in a building full of lockers and get their parcel delivered there. They get an OTP to access that locker. If they don’t pick up their item in 7 days, the item is returned and the locker should be vacated. The system should know which lockers are available to be booked, and if items are not picked, the locker should become available again. Users can pick any locker from available lockers in a nearby location.

Candidate's Approach

I implemented almost all the required functionalities with modular code, but was unable to finish the 7 days expiration policy. I overcomplicated the data structures a bit, but when asked why I needed them, I quickly realized we could simplify it. We had a verbal discussion on the 7-day expiration policy, and the idea was considered good by the interviewer.

Interviewer's Feedback

No feedback provided.


Round 3: HLD/HM

Questions: You have a huge area of around 10 million km². You have sensors in every 10 km² that send you temperature data. Design a system to show current temperature and also support querying past temperatures.

Candidate's Approach

I listed all the functional and non-functional requirements, did QPS and storage estimates. My whole design was based on Amazon tech. There were a lot of cross questions like push vs pull model, and I struggled to answer two of them. I also couldn't add a SQL database for recent data, which was discussed verbally. I mentioned how we could add some ML to show future predictions.

Interviewer's Feedback

No feedback provided.


Round 4: Bar raiser

Questions: Interviewer started with 2 sum in an unsorted array. I quickly gave 3 ideas for that: O(n * n), O(n * log(n)), and O(n). He didn’t ask me to implement any of those.

Follow-up: Assume that you already have a function vector<vector<int>> getPairs(vector<int> arr, int target) which returns pairs that sum up to target in array arr. Write a code for vector<vector<int>> getKDimensions(int k, vector<int> arr, int target) where you pick k distinct indices from arr that sum up to target. You must use the getPairs function above.

Candidate's Approach

This one had a short recursive code with exponential time complexity - there’s no way to avoid that. I didn’t exactly remember the function signature for vector insert(), but the interviewer was okay with it, and the code was considered good by the interviewer. I was unsure about the time complexity as the code was slightly complicated to analyze, and I mentioned that I might be off by a factor of n. The interviewer accepted that.

Interviewer's Feedback

No feedback provided.


Compensation

Compensation Discussion