# Amazon Interview | Set 68 (For SDE-1)

I went through the Amazon interview process for SDE-1, I didn’t make it past the 3rd F2F round.

Online Round:
1. Find if a given string contains duplicates
2. Given a BST, find the maximum N elements of the tree
3. Given a BST, convert it into Doubly Linked List
4. Rotate a 2-D Matrix by 90 degrees
Telephonic Interview:
1. Given an array of integers (+ve and -ve), give a contiguous set of numbers that add to 1
Eg. 4 3 5 -3 -1 2 -3 10 2
Ans: 5 -3 -1 2 -3

3. In a 2-D Matrix with the following properties:
i. Contains only 1s and 0s
ii. Every Row is sorted
Find the row with maximum zeroes.

F2F:
Round 1:

1. Print all the cycles in a directed graph

2. Given an unsorted array, assign every element to its immediate larger number after the current number, assign to -1 if no such number exists
Eg. 3 1 2 5 9 4 8 should be converted to
5 2 5 9 -1 8 -1

Round 2:
1. In a 2 D array where every row and column are sorted, give the nth smallest element
2. In a Binary tree, every element must contain the sum of its sub-trees
Follow up question: how would you solve this if you can ONLY increment the value of a node
Eg. If a node’s value is 20 and its sub-tree sum is 10, the node’s value can’t be set to 10 because you can only increment

3. Given n, find the smallest number for which product of the digits is n, if no such number exists, print -1
Note: Digits can only be split as single digits, i.e., 132 can’t considered as 1 * 32 or 13 * 2, it would only be 1 * 3 * 2
Eg. Answer for 36 would be 49

Round 3:
1. Convert a Binary tree into another binary tree whose in-order traversal gives a sorted list
This has to be done in-place

Eg.

```        1
2       3
4   5   6     7

should be converted into

4
2       6
1   3   5     7```

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

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

My Personal Notes arrow_drop_up
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.