Question: Amazon-SDE1 (On Campus)
Entering edit mode

Role: Software Development Engineer 1

Campus: NIT Surat

CTC - 46 LPA

Breakup (updated) -

  • Base - 1,917,000
  • Sign on 1 - 647,000
  • Sign on 2 - 518,000
  • RSU Value - 1,556,000 (vested over 4 years, 5% | 15% | 40% | 40%)


  • 05/ 08/ 2022: OA was conducted.
  • 24/ 08/ 2022: Shortlists for interviews announced.
  • 05/ 09/ 2022: Interviews.
  • 08/ 09/ 2022: Results announced.

44 were shortlisted for the interviews, among those 32 were eligible, and 11 were selected after the interviews.

Online Assessment (First shortlisting)

Amazon standard OA, consisted of 3 rounds (all compulsory and unproctured) and the result is given based on all the rounds combined.

Coding round

2 Coding Questions on Hackerrank Platform

The time allotted is 2 hours, but try to complete both questions within 30 mins. Most of the shortlisted students completed both questions in around 15-20 minutes.

Easy to medium-level questions. One was a prefix sum based easy question, other was a variation of group merging.

Workstyle Assessment

This is a special round that assesses you based on decisions you make in the workstyle environment. There will be questions based on debugging, making decisions for you and your colleagues, and managerial decisions based on facts and reports. There is no time limit but try to complete it in 2-3 hours.

Leadership Principles

Large Questionnaire based on selecting from 2 given options. Most will be based on the leadership principles followed by Amazon. Go through them once before giving this round. No time limit for this round.

Interview Round

There were 3 technical+ leadership-based interview rounds (60 minutes or more based on your answers) and all were elimination rounds. Try to be vocal in each round and think out loud. The interviewer will always try to help you out if you're stuck somewhere.

Round 1

Click here to Practice

Q1: Find a single element in a sorted array of pairs of elements. LeetCode

Q2: Kth largest element in BST. GFG, GFG

Few questions regarding internships and projects.

I was stuck on the first question for a while and gave 2-3 approaches but the interviewer still asked me to think of a better approach, after 15-20 mins of discussion with the interviewer, I gave an approach in which the interviewer was satisfied and I quickly coded it up. I was able to Code the second question in time and the interviewer was satisfied with my approach and answers. I asked the interviewer about some of the areas that they work on at Amazon.

Verdict: Qualified for the next round.

Round 2

Q1: Maximum area of an island. LeetCode

Click here to Practice

Q2: Right-side view of a binary tree. LeetCode

Click here to Practice

The interviewer was of a similar background as me so he chatted me up at the start of the interview and cross-questioned me regarding some of my projects. The interviewer was very friendly and helpful throughout. I was able to Code both questions in time and the interviewer was satisfied with my approach and answers.

Verdict: Qualified for the next round.

Round 3

Q1: Minimum cost of joining ropes. LeetCode

Click here to Practice

Q2: Next greatest element. LeetCode

Click here to Practice

Few questions regarding my contribution to the company and my work during my internship, any hurdles faced during working with the team and how I dealt with them. A few questions regarding teamwork in my projects. This round went on for a little longer than the previous two.

I asked the interviewer about some major Departments that Amazon India works on and the current major research going on in the fields.

Final Verdict: Selected

Entering edit mode

Solution to Next Greater Element


We maintain a monotonic stack to solve this problem for all elements in the array. In order to find the next greater element, we should compare the current element with the elements in the stack.

  • If current element > top element of the stack, current element is the next greater element of top element. We should also pop the top element because the current element could also be the next greater element of top element’s previous element.
  • If current element <= top element of the stack, current element is not the next greater element. In this case, we push it into the stack and keep looking for the next greater elements.

enter image description here


nextGreaterElement(n, nums):
    ans = [-1]*n
    stack&lt;int&gt; st
    for i from 0 to n:
        while(!st.empty() and nums[i] &gt; nums[]) ans[] = nums[i], st.pop()
    return ans


The time and space complexity are both O(N).

ADD COMMENTlink 18 months ago Ayush Gangwani 1.1k
Entering edit mode

Round 2 Question 1


Given a grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.). Find the maximum area of an island.


For every un-visited 1, we can do bfs from that and maintain a count of ones encountered, which will tell the area of the island. Max of all such counts is the answer.

C++ Code:

int solve(vector&lt;vector&lt;int&gt;&gt; grid) {
    int n=grid.size(),m=grid[0].size();
    vector&lt;vector&lt;int&gt;&gt; vis(n,vector&lt;int&gt;(m,0));
    vector&lt;int&gt; dx={1,-1,0,0};        
    vector&lt;int&gt; dy={0,0,1,-1};        
    int ans=0;
    for(int i = 0;i &lt; n;i++)
        for(int j = 0;j &lt; m;j++)
            queue&lt;pair&lt;int,int&gt;&gt; q;
            int cnt=0;
                auto x=q.front();
                for(int l = 0;l &lt; 4;l++)
                    int ni=x.first+dx[l],nj=x.second+dy[l];
    return ans;

Time Complexity: O(N*M)

ADD COMMENTlink 18 months ago hardik kapoor 130
Entering edit mode

Round 3 Question 1


  • Find the minimum cost to merge all piles of ropes into one pile.


  • We know that we will be left with only one pile after all merge operations.

  • Now, let's begin thinking that in order to create one pile at the end, we, in the previous step, should be left with K piles so as to merge them into one pile. However, to obtain the minimum cost of creating one pile, we must create K piles in the previous step with minimum cost.

  • We need to know the minimum cost of merging the left part to k - 1 piles and the right part to 1 piles.

  • State: Minimum cost merging piles from i to j to k pile.


dp[i][j][1] = dp[i][j][K] + sum[i][j] (dp[i][j][K] != max) 

dp[i][j][k] = min(dp[i][t][k - 1] + dp[t + 1][j][1]) (t ∈ [i, j) &amp;&amp; dp[i][t][k - 1] != max &amp;&amp; dp[t+1][j][1] != max &amp;&amp; k ∈ [2, K]) 

Init: dp[i][i][1] = 0 (Already a pile) others = max 

Answer: dp[1][len][1] (len is the ropes number)


Time Complexity: O(N^3 * K), N is the size of the array.

ADD COMMENTlink 18 months ago Akash 230
Entering edit mode

Question 4 :Right side view


Print the right side view of binary tree.


  • Create an array whose length is equal to the height of the tree.
  • apply any traversal and keep track of the level of every node in the tree of particular depth and keep updating in the array.
    • while calling child just decrease and increase the levels of left and right nodes accordingly.
  • always keep updating if at any depth you got a node whose level is higher then the previous.


> O(n) where n is number of nodes in the binary tree.

C++ Code

void traverse(int node,vector&lt;vector&lt;int&gt;&gt;&amp; level,int height,int cur_level){
  if(cur_level&gt;level[heigh][0]) {
    level[height][0]= cur_level;
    level[height][1]= tree[node];
ADD COMMENTlink 18 months ago Rishabh Verma 160

Login before adding your answer.

Similar Posts
Loading Similar Posts