# 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.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!