Amazon SDE II Intern | Coding challenge | Interview experience | August 2024 | Accepted

amazon logo
amazon
SDE II InternOffer
August 27, 20245 reads

Summary

I successfully cleared the Amazon SDE II Intern interview process, securing an offer after a challenging online assessment and a technical interview.

Full Experience

My Internship Journey at Amazon

I recently embarked on my internship journey with Amazon, and I'm thrilled to share my experience. Despite attempting around 12-15 online assessments for various companies, Amazon was the first to shortlist me, and I managed to clear the entire interview process in a single go.

Online Assessment (2 questions, 70 minutes)

The online assessment consisted of two coding questions. The first involved selecting prefixes of an array, decrementing elements, and counting the maximum number of zeros without any element becoming negative. I had to achieve an O(n) time complexity, which was a bit challenging but I managed to figure out the optimal solution during the exam.

The second question required me to count segments in an array of strings where the vowel count was less than or equal to a given threshold. For this, I implemented a brute-force approach, which ran in O(n^2) time complexity. I solved both questions successfully, leading to my shortlisting for the interview round.

Interview Experience

The interview began with a basic introduction. Following that, we dived into Data Structures and Algorithms questions. The first question was a modification of a GeeksforGeeks problem related to run-length encoding. The modifications involved handling only lowercase letters and a special rule for characters occurring more than 9 times. I solved this one correctly in a single attempt, using an O(n) approach, which was quite straightforward.

The second question was directly from GeeksforGeeks: "Check if Leaf Traversal of Two Binary Trees is Same". Initially, I proposed an incorrect approach using level order traversal. However, the interviewer provided a sample case that helped me realize my mistake. I then quickly figured out the correct approach and proceeded to code it. The interviewer seemed quite impressed with my solutions and mentioned he had no further questions. He then asked if I had any questions for him. I asked, "What is the definition of a good code according to you sir? When a student writes a code what are the key elements that you look into?" He answered thoroughly, and then informed me that the recruiting team would update me with the next steps. Shortly after, I received the fantastic news: I GOT HIRED!

Interview Questions (4)

Q1
Maximize Zeros by Decrementing Prefixes
Data Structures & Algorithms

Select prefix of any length from an array and decrement each element in that prefix length by 1. Make sure no element becomes negative. Count maximum number of zeros after all possible operations. Sample case :- [3,2,4,4,1] Output:- 3 Explaination:- Select prefix of size 5, [3,2,4,4,1] -> [2,1,3,3,0]. Now choose prefix of size 4, [2,1,3,3,0] -> [1,0,2,2,0]. Now we have to choose prefix of size 1 because 1st index will become negative if we try to make further elements smaller... [1,0,2,2,0] -> [0,0,2,2,0]. Had to do this in time complexity of O(n).

Q2
Count Segments with Vowel Count Less Than or Equal to Threshold
Data Structures & Algorithms

Given an array of strings and a threshold value count the number of segments which have count of vowels less than or equal to the value of the threshold. Sample case :- ["lciy","ttrd","aod"] , threshold = 1 Output:- 3 Explaination:- Segments with vowel count less than or equal to 1 :- ["lciy"],["lciy","ttrd"],["ttrd"].

Q3
Run-Length Encoding String with 9+ Character Count Rule
Data Structures & Algorithms

A modified version of the GeeksforGeeks problem "Easy String" (https://www.geeksforgeeks.org/problems/easy-string2212/1). Modifications: i) String consisted only lowercase letters. ii) If a character occurred more than 9 times then we have to return "9" + "that char" and continue counting again. Sample case 1:- "aaaaaaaaaaaaaabbeee" Output:-"9a5a2b3e" Sample case 2 :- "abcde" Output :- "1a1b1c1d1e".

Q4
Check if Leaf Traversal of Two Binary Trees is Same
Data Structures & Algorithms

The exact same question as found on GeeksforGeeks: "Check if Leaf Traversal of Two Binary Trees is Same" (https://www.geeksforgeeks.org/check-if-leaf-traversal-of-two-binary-trees-is-same/).

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!