# Amazon SDE-1 Interview Experience | Women of World 2020

Round 1:

Q1) Given the column number in an Excel sheet, find the column name.

https://www.geeksforgeeks.org/find-excel-column-name-given-number/

Q2) Given a binary tree find the maximum sum from one leaf node to another.

https://www.geeksforgeeks.org/find-maximum-path-sum-two-leaves-binary-tree/

Q3) Modify Facebook’s friend request operation by adding a condition that a person can only send a friend request to someone if they have at least 1 mutual friend.

Here the interviewer asked to use an appropriate DS to store the friend list. I used the adjacency list representation and searched for common values in the two lists.

Round 2:

Q1) Given a binary tree, perform Zig-Zag level order traversal of the tree.

https://www.geeksforgeeks.org/zigzag-tree-traversal/

Q2) Given a tree T1 with millions of nodes and a tree T2 with hundreds of nodes check if T2 is a subtree of T1.

Q3) Difference between an interface and an abstract class.

I wrote a Java code to explain different scenarios where each of them can be used.

Q4) Reader Writer conflict in DBMS.

Round 3:

This round started with a project discussion. I explained my project and he asked some questions related to it.

Q1) You purchased a product from Amazon and now wish to return it. There are N pick up agents in your locality, you have to return the K closest ones.

I first solved it by sorting the distances and returning first K values. The interviewer asked me to optimize the solution. I solved it using a max heap.

Q2) Given a dictionary of strings and two strings s1 and s2, check if you can reach from s1 to s2 by selecting words from the dictionary. At each step, you are allowed to change only one letter of s1 at a time.

eg. dictionary = {cat, bat, pat, but, bun, sun, pun, put}

s1=cat, s2=sun

or cat->pat->put->pun->sun

I solved it by making an adjacency list for each string and then DFS to check the reachability of s2 from s1.

Round 4:

This round started with a discussion of all the questions asked in the previous round.

Q1) Find the diameter of a given n-ary tree and return the two end nodes of the diameter.

I first solved it for a binary tree then extended the solution for an n-ary tree.

Q2) What happens when you type www.amazon.com?

A long discussion on DNS, ARP, and TCP/IP stack was done.

Q3) What is a deadlock? What are the conditions for a deadlock to occur?

Q4) Http vs Https

The interviewers were really motivating and friendly. I had an amazing experience and enjoyed solving problems in all of these rounds. Just maintain a calm mind during your interview; it will help you solve the problems quickly.

Verdict: Selected!