# Amazon Interview Experience (SDE-1, 8 month experience, Refferal)

• Difficulty Level : Medium
• Last Updated : 13 Apr, 2020

Round 1:  (1 hour)

Que 1:  You are given a list of packages and their dependencies as follows.
You need to return one of the order in which the packages should be compiled.
< 1, <2, 3, 10> >, < 7, <>>, < 2, <4, 5> >, < 3, < 5, 6, 7> >, < 8, <>>, <4, < >>,
<5, <6> >, < 6, <> >, < 10, <> >
Output Example – 6, 4, 5, 7, 2, 3, 8, 10, 1 –> If we can compile, else return NULL.

Topics: Graph, Topological sort, Cycle in a graph

Que 2: There are N Ropes. You need to connect N ropes into single rope into minimum cost.
Cost of connecting 2 ropes is length of connecting 2 ropes.
For 4, 3, 2, 6 length ropes ? Output will be 29.

Example: One of the ways to connect the rope. But you have to tell them the minimum cost.
4+6 = 10 –> [10, 3, 2]
10 + 3 = 13 –> [13, 2]
13+2 = 15 –> [15]
Total Cost = 10 + 13 + 15 = 38.

Topics: Min-Heap, Greedy

Round 2:  (1 hour)

Que 1: Q: Print a Binary Tree level by level alternating the order each level. (ZIG- ZAG Tree Traversal).

Topics: Tree, Dequeue, Stacks

Que 2:  Find the rank-k (k-th maximum) in a continuous stream of numbers.

Topics: Heap

> k=1
> 10, 5, 7, 3 => 10
> 10, 5, 7, 3, 12 => 12
> 10, 5, 7, 3, 12, 11, 15, 9 => 15

> k=2
> 10, 5, 7, 3 => 7
> 10, 5, 7, 3, 12 => 10
> 10, 5, 7, 3, 12, 11, 15, 9 => 12

Round 3: (1 hour)

Print top view of a binary tree.

Topics: Tree, queue

Round 4: Managerial round (40 minutes)

No coding questions in this round. Questions in this round were related to projects and past experiences only.

Every round was followed by a 10 minute discussion related to what you are doing in the current company and past experiences. And no doubt interviewers were very friendly.

My Personal Notes arrow_drop_up