# Amazon Interview Experience | SDE-2

Usually Amazon SDE-2 interviews happens in 2 days schedule. On the 1st day there will be 3 rounds (PS/DS and design rounds). If the feedback is good you then will be called for remaining 2 rounds which are Manager and Bar raiser.

In my case date of joining was very close in some other org, so all 5 rounds happened on one day.

Round 1 PS/DS:
Q1.
Given a binary tree you have to print endmost node in zig zag fashion.
Example:

1
/     \
2        3
/     \    /    \
4     5   6    7
\
8

Output should be : 1, 3, 4, 8
Soln: Level Order traversal using node count approach and using flag to decide which node end you have to print (leftmost or rightmost)

Q2. Given snake and ladder board you have to find minimum no. of move required to reach end of board.

Round 2: PS/DS

Q1) Given following piece of code and two int arrays A & B of equal size n, explain what is it doing.

ans = 0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
for(int k=0;k<n;k++){

if(A[i]!=B[i] && A[j] ! = B[k] && A[k]!=B[k]){ ans = max(ans, A[i] + A[j] + A[k]);}

}

Sol’n: Basically this code is finding max sum triplet from A array such that value in those indexes of B array  is different.

Next he asked me to re write this code with better time complexity.

Q2.  Given a binary tree, find path in the tree such that the sum of nodes in path is equal to given K. Path can start from any nodes and can end on any nodes.

1
/     \
2          3
/     \    /    \
4     5   6    7
\
8

Example : for k = 10, there will be 2 paths: 1->3-> 6 and 3->7

Use following concept:
https://www.geeksforgeeks.org/find-subarray-with-given-sum/

https://www.geeksforgeeks.org/find-subarray-with-given-sum-in-array-of-integers/

Round 3: Design

Design Dominoes website. This was mainly focused on High level design and you have to mention all the major components like Delivery tracking system, User Signup/Login flow, Fulfillment service etc.
You have to describe complete flow of a order until its delivery to customer.
Interviewer also asked me to write schema details for few entities.

Round 4: Manager

In the first of half of this round we mostly discussed about my work experience and role which is played in my current team.
In the second half he asked me to design Job management system where user submits a job and specify the time its should run just like Airflow app.

Round 5: Bar raiser
This one was mostly discussion oriented to judge on the basis of Amazon leadership principles. You have to mention few scenarios about your work and how you have applied those leadership principles.

Few questions which I remember were why did I used Golang instead of Java, most challenging tasks which I have worked on.

Finally, after few days I received positive feedback from HR.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.