Amazon SDE-1 2023/2024 Graduate | Round 2 | Banglore

amazon logo
amazon
SDE-1 2023/2024 GraduateBanglore
April 8, 20253 reads

Summary

I recently completed my second round interview for the Amazon SDE-1 role in Bangalore, where I discussed my projects, solved two Data Structures and Algorithms problems, and addressed edge cases for a power function implementation.

Full Experience

Hi Leetcode community. Today I had my second round of interview after nearly 2.5 weeks of 1st round. I've posted my first round interview in the following thread : link

- I was asked to introduce about me, further interviewer asked questions about my role in the team, projects I've worked on for around 15 minutes.
- Later he provided me the following 2 DSA questions which are actually quite easy as they're standard.


Question 1: A Sum Tree is a binary tree where each node's value is equal to the sum of its left and right subtree values. Validate if a given tree is sum tree or not.

    26
    /\      2nd level 4+6 = 10 | 3+0 = 3
  10  3     1st level 10+10 = 20 | 3+3 = 6 
  /\   \    0th level 20+6 = 26
 4  6   3

Question 2: https://leetcode.com/problems/minimum-knight-moves/description/
Here I provided a bfs approach, however he asked me why BFS over DFS and what's the role of queue that is doing here?. So it's obviously hard to explain in english, I took a proper example and made a dry to show how BFS queue benfits over DFS in terms of time.


- So I completed these two questions in 35min, by explaining my approach, dry-run and wrote the code in bestway (as code style will be asserted).
- We were left with around 10 minutes so he just wanted to check my edge-case detecting skills in the left over-time.

Question 3: He just asked me to find a to the power of b:
- Took variable to calculate answer as long
- Handled a=0 && b=0 edge case, by throwing exception
- Handled cases like b<=0.

However interviewer gave me another edge case of a=0 b=-3, for which I didnt handle as for negative powers logic is 1.0/ans so here it'll be (1/0). Later I incorporated this change.

Overall my interview went fine, I request guidance for the 3rd round thank you.

Interview Questions (3)

Q1
Validate Sum Tree
Data Structures & AlgorithmsEasy

A Sum Tree is a binary tree where each node's value is equal to the sum of its left and right subtree values. Validate if a given tree is sum tree or not.

    26
    /\      2nd level 4+6 = 10 | 3+0 = 3
  10  3     1st level 10+10 = 20 | 3+3 = 6 
  /\   \    0th level 20+6 = 26
 4  6   3
Q2
Minimum Knight Moves
Data Structures & Algorithms

I was given the problem at the provided link. I provided a BFS approach, and the interviewer asked me to explain why BFS over DFS and the role of the queue. I used an example and a dry run to demonstrate how BFS benefits over DFS in terms of time.

Q3
Implement power(a, b)
Data Structures & Algorithms

He just asked me to find a to the power of b.

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!