SDE 1 amazon Interview '23 batch

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-03-21Added By Anonymous
Source: Link

Company: Amazon
Role: SDE I
Interview Stage: Phone Interview
Location: unknown
Year: 2023

Original Post Content:

Recently interviewed for Amazon SDE-1, applied through referral.

1. OA
Two easy-medium array questions.

2. Phone Interview.
There were two interviewers, both were SDE-2 (22 batch). They introduced themselves, so did I. Before jumping into DSA, they asked a few LP and resume-based questions and then jumped to DSA.

Question 1: Need to return an index of an element from an array such that every element on the left side is equal to or less than, and every element on the right side is equal to or greater than.

Firstly, I came up with an O(N*N) solution, and then after discussion, using prefix sum, I was able to do it in O(N) and extra space.

Question 2: You need to transform a tree into the sum of its left child and right child, but here the catch is you can't decrement the root value.

      ex.
        50
      /    \
     7      2   
    /  \  /  \
    3   5  1   30

So, if we do sum 3+5=8 and 1+30=31, replace 7->8 and 2->31, but 31+8=39 which is not equal to 50 (you can't decrement root values). So this is not a valid sumTree.

      there are many ans one could.
        50
      /    \
     10     40   
    /  \  /  \
    5   5  8   32

Initially, I struggled a little bit (just started my prep for job switch), but then I came up with a solution and they were happy with the approach. Coded both questions and dry run.

After this, they asked me questions related to Java and Spring, as well as resume questions. The interview was for one hour but ended in one and a half.

Comments