amazon logo
Amazon· SDE-1 2023/2024 Graduate

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

Location
Banglore
Posted
8 Apr 2025
277 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.

How it went

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.

Questions asked (3)

  1. 01

    Validate Sum Tree

    Data Structures & Algorithms · Easy

    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
    
  2. 02

    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.

    Open the problem
  3. 03

    Implement power(a, b)

    Data Structures & Algorithms

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

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Amazon recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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