Amazon SDE 1 | Round 1 Interview Exp | Please don't make this mistake

Anonymous User
1607
Mar 18, 2025
Mar 19, 2025

When Life gives you lemons, you make lemonade out of it, dont be like me

"Please dont judge, already regretting that I could not solve two Easy Level questions"

About Me:
Batch: 2024 CSE, Tier - 3
YOE : 0 (yet to get a job)
LeetCode: Solved 280 problems, gave 14 contests, Top 29%
Leadership Principles Resource link: https://leetcode.com/discuss/post/6482779/amazon-lp-questions-list-that-i-created-xg3fb/

After clearing the OA(cleared 1.5 out of 2 questions) on feb 3 , got a mail on 21st feb that i've cleared the OA and Interviews will be scheduled from feb 24 - March 7th
(dont remember the OA questions, but one was PriorityQueue based)


ROUND 1 - TWO INTERVIEWERS WERE PRESENT

Interviewers were from amazon's Alexa team(3+ YOE & 4+ YOE). They Introduced themselves first and I did the same. Usually I always keep my Intro such that the interviewers would ask me questions immediately.

  • LP? not exactly, the questions to my intro were quite direct and not needed any STAR format explanation.
  • The Interviewer was satisfied and moved onto the coding questions.

Coding Ques 1:

You are given a numerical value in the form of a string. Your task is to round this number to the nearest multiple of 10.
If there are multiple neaarest values, return the smaller one.(no negative numbers or decimals). Return String.

Example: "27"
Output: "30"
Explanation: 27 has two nearer multiples 20 and 30, 27 is close to 30 so return 30

Example: "15"
ans: "10"
Explanation: there multiple options such as 10 and 20, both are qualy close so return the smaller one

My First Intuition: Binary Search on answers, but the interviewer said you could more smplify the search(He thought I would take an array of answers leading to heavy space), So I came up with an intuition that " why to take a logN time, we could do it in a O(1) time instead."
-> I converted the String to Integer then solved the problem,Interviewer was satisfied but
Here comes the follow up for every easy problem

  • FollowUp: What if the given String value is huge, even greater than Long and Big Int?
  • I wrote the approach but it was missing one main case for deciding the boundary for lastDigit > 5
  • MAIN EDGE CASE: Try for "999", "99999" you'll know why.
  • After this time was already 36 mins up so he moved on.

Coding Ques 2:

Amazon Alexa Music Recommendation -
The Amazon Alexa team is working on improving its music recommendation system. The system represents user song preferences as a binary tree, where each node contains a unique song ID. However, the songs at each level of the tree are not in a proper manner so that we can recommend them to the user.

Your task is to determine the minimum number of swaps required to sort the song IDs at each level in ascending order. You need to return the total number of swaps required for the entire tree.

Example:
5
/ \
8 3
/ \ / \
10 2 7 6

Levels and Swaps Needed:

Level 0: [5] (Already sorted, swaps = 0)
Level 1: [3, 8] (not sorted, swaps = 1)
Level 2: [10, 2, 7, 6] → not Sorted (Swaps = 2)

total swaps needed: 3

  • So, A simple BFS for traversing Level wise is needed and the only task i needed to do was to optimally find the no of swaps at each level. The problem was , I could not recall the Sorting Algo's.
  • Struggled a lot, came up with an approach but had to trade it off with Space, it was to make duplicate list of each level and sort it, then compare the mismatched values so that I would know the no of swaps I can get but this will faild for Odd length as swaps can happen repeatedly.
  • The interviewer helped, You can use any sorting algorithm right? But I said I couldn't recall it atm, so he told me to write the pseudo code for 80% of the problem which ivloves the BFS as only 6 or 7 mins were left. the last 5 mins are given for me to ask questions.
  • I just needed to write a sorting algo, and increment the count variable for every swap that is happening in the algo. thats it, I knew what to do, but didnt know how to implement that.

Key Learnings:

  • Always give importance to the completeness of the code.
  • Always maintain a habit of writing pseudo code Quickly.
  • Remember the Sorting Algo even though you learn this at the very start of your DSA journey. Basically keep revising concepts every Sunday.
  • Whenever you're explaining your approach, you need to simultaneously write it down for the interviewer.
  • Just give a lots and lots of Contests. This will help you turn your Ideas into code quickly!

I've tried my best to summarize the experience in a long way, But please upvote so that others can learn and also let me know some of your advices so that I can overcome the problem of "Finding the optimal approach but it takes a lot of time and effort to code, where at times I get distracted"

Comments (7)