# Amazon Interview Experience SDE Intern | Set 5

Company Name: Amazon

Job Role: SDE Intern (6 months)

Years of Experience Required: Fresher

Drive: Offcampus (AmazeWow for 2022)

## Preparation for Amazon

Topics: DSA and CS fundamentals

Duration: 1 year

Source of Preparation: GFG, leetcode, Striver’s youtube channel and SDE SHEET

[BONUS]:

## Interview Rounds

Round 1: Online Coding Test

Problem List:

** I don’t remember the questions exactly, but one was DP and the other was a tree question**

Problem Statement: Enter the problem statement here as clearly as possible, for example: “Given an array of N integers, write a program to swap all consecutive integers.”

Examples: [Not Mandatory]

```Input Format: N = 5, array[] = {1,2,3,4,5}

Result: 2,1,4,3,5

Explanation: Give a very clear understanding to the reader between the corelation of Input and Output relating to the problem statement.```

Round 2: Video Call (TR).

Problem 1: There was n packages and there are several packages that are dependent on it. What should be the order of packages that we need to transport In order to reach from source to destination.

Examples:

```Input:
PackageA - > PackageB
PackageB -> PackageC, PackageD
packageD -> PackageH
PackageH-> PackageG

Source: PackageA

Destination: PackageG

Ouput: PackageA -> PackageB -> PackageD -> PackageH -> PackageG.

Explaination: A simple DFS call from source to destination. Input should be string format only, so make your adjacency list likewise.```

Problem 2: Given a string having digits 0 to 9, output all possible IP addresses that can be made from it.

Constraints: It should be divided into 4 subnets. It can have a 0, but no preceding zero. Numbers should lie between 0 to 255. If it’s not possible, return an empty list.

```Input: “255557”

Output: [“25.55.57”, “255.55.7”, “255.5.57”]

Explaination: It’s a backtracking question which has following possibilities:
1. If first character is zero, just include it and move to next subnet.
2. Numbers should lie between 0 to 255.
3. Backtrack all the solutions you get.```

Refer to Restore IP Address problem (Leetcode)

Round 3: Video Call (TR)

This round started with a bit of discussion on my previous internship experience and he gave me a situation where I had to apply the STAR approach and answer it.

Problem 1: In Microsoft paint, there are boundaries for every color we try to fill in. When we apply a particular color to any region, the entire region within the boundary gets painted and if its same color, nothing happens. How would you implement it.

```Input: Color given in matrix format:

[1, 1, 1, 1, 1, 1
2, 0, 1, 2, 1, 1
3, 1, 3, 2, 0, 0]

Start: (0,2). newColor= 3

Output :
[3, 3, 3, 3, 3, 3
2, 0, 3, 2, 3, 3
3, 1, 3, 2, 0, 0]

Explanation: Matrix dfs problem.

Start with the point given in input. Do a dfs call to the four sides and if the original color is different from the new one, change it and again go for a dfs.```

Problem 2: Calculate the height of a tree. Later he added, if the leaves are doubly LinkedList, how to do the same.

```Input:
2
/ \
4   7
/\    \
6  5    9
/
1

Output: 4

Explanation: First calculate height that we do normally. Now condition for the leaf doubly linked list is:

Let dummy = node->right

If dummy -> left == node
// node is a “Leaf node” return 1```

Verdict: Selected

Message to Aspiring Students:

To all the ones reading this, prepare your DSA and CS fundamentals well. Keep your basics to the point always, sometimes they just twist the question to test your basics. It may so happen sometimes that you know the concept pretty well, but the code is not to the point, but that’s okay. Try to communicate and think loud. The interviewers are very friendly, just think it as a normal discussion with your peers and you’re gonna ace it.

All the best!!

~Nutan Hotwani

Active Linkedin Profiles for Seeking referral at Amazon: Reach out to me: Nutan Hotwani.