# Amazon interview Experience | Set 135 (On-Campus for SDE)

Recently, Amazon visited our campus and I was interviewed for SDE position. Here is my Interview Experience:

**Online Round: (Duration – 90 minutes)**

20 MCQs and 2 coding questions. MCQs were on Algorithms, Time Complexity, Quantitative Aptitude, Probability, Operating Systems, Graphs, Data Structures, Recursion outputs etc.

Coding Questions:

1. In one of Amazon fulfillment centers, there are a no. of empty boxes kept in increasing order in a row. Kiva robots are designed to put a product in a box. The product size is given. Design a program to find the best fit box for given product size. First line contains no. of empty boxes and next line contains size of boxes with space. The next line contains size of given product. The output shows the best fit box size and -1 otherwise.

For example, Input: 6 2 7 9 11 13 16 12 Output: 13

2. You have to find a string in two-dimensional array. The input contains 2-D array of characters and given string. You can move in one of eight directions . The output contains location of first letter of string if string found completely, otherwise return -1. Any one out of multiple answers is accepted, if possible.

For example, Input:

b t g

p a d

r k j

String: rat

Output: (2,0)

**F2F Round 1:**

Brief introduction about myself and my project.

1. Given an array of positive and negative integers, rearrange positive and negative numbers in 0(n) time .

First, I solved it using 2 arrays,each for positive and negative integers and place elements of array in these 2 arrays and them combine them back by taking one element from each array. Then he told me to do without extra space. I then segregated positive and negative elements using quicksort .

2. Program to check whether strings are rotation of each other or not. I approached as below:

He then told to solve without using strstr. I used naive searching method.

**F2F Round 2 :**

Brief introduction and some behavioral questions.

Given a BST and a key sum, design an algorithm to find all pairs of integers whose sum equal to key.

I first approached using an array and placing elements into it in inorder fashion and then find pairs. He told to do in-place and I solved with 2 traversals (inorder and reverse- inorder ) .

**F2F Round 3 :**

Based on CS Fundamentals and also had 15 minutes discussion on my internship project.

1. What happens when we type amazon.com ?

2. Describe transaction process in detail if we want to transfer from one account to other. Also design schema for it.

3. What happens on server side on receiving HTTP requests and how operating system interacts and then discussion related with threading, thread pool ,synchronization, hashing etc.

4. Describe ACID properties in detail .

**Bar Raiser Round :**

1. Given a Binary tree, full_path_sum is sum of all nodes from root to leaf in a path. Given a min_sum value, delete nodes if path has full_path_sum less than min_sum . Delete all such nodes . For example,

Given min_sum =8 1 2 3 4 5 6 7 So we delete 4.

2. How to find kth- smallest element in BST?

Thank you geeksforgeeks for helping me a lot during my preparation.

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.