# Amazon Interview Experience : SDE : Set 51

Company Name: Amazon

Job Role: SDE

Years of Experience Required: Fresher (0 Yrs.)

Drive: Off-Campus (Referral)

## Preparation for Amazon

Topics: Data Structures and Algorithms

Duration: 1.5 years

Source of Preparation: Codechef,  Leetcode, GFG, Striver’s SDE sheet.

[BONUS]:

### Interview Rounds

Round 1: Online Coding Test

• Next greater permutation: Given an array Arr[] of integers, rearrange the numbers of the given array into the lexicographically next greater permutation of numbers. If such an arrangement is not possible, it must rearrange in as the lowest possible order (i.e., sorted in ascending order).
• Diameter of Binary Tree:  Find the Diameter of a Binary Tree. Diameter is the length of the longest path between any 2 nodes in the tree and this path may or may not pass from the root.

Round 2: Technical Interview

• Given a link list of 0’s and 1’s sort it so that all the 0’s are at beginning and 1’s at the end.
• Given a string find a repeating substring of maximum length.

Round 3: Technical Interview

• Maximum depth of a Binary Tree: Find the Maximum Depth of a Binary Tree. Maximum Depth is the count of nodes of the longest path from the root node to the leaf node.
• Lowest Common Ancestor for two given nodes:  Given a binary tree, Find the Lowest Common Ancestor for two given Nodes (x,y). Lowest Common Ancestor(LCA): The lowest common ancestor is defined between two nodes x and y as the lowest node in T that has both x and y as descendants (where we allow a node to be a descendant of itself.

Round 4: Technical + Managerial

Only one question:

• Given an infinite integer number line, find the minimum steps required to reach a particular point. 0 is the starting point and at the ith step we can move +i or -i step from the current position.

Verdict: Selected