Related Articles
Amazon Interview | Set 112 (On-Campus)
• Last Updated : 20 Jun, 2019

Amazon visited our campus and was hired as intern. These are the questions that I faced.

Online Round (90 minutes)
20 Basic MCQs (Data structure, C, C++, OS, Aptitude, Networks).
2 programs :
1. Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] and its permutations (or anagrams) in txt[]

```E.g. : I/p : txt[] = “BACDGABCDA” pat[] = “ABCD”
o/p :0,5,6 ```

2. There is a matrix mat[m][n] with entries as 0 or 1 When you are at 1 you can move in all the eight directions and when at 0, you have to return back. Find the number of cluster of 1’s

```e.g. input  { {1,1,0,0,0},
{1,0,0,1,0},
{0,0,0,1,1},
{1,0,1,0,0}  }
output 3

clusters ((0,0),(0,1),(1,0))
(1,2),(2,2),(2,3),(3,2)
(3,0)```

Round 1:
1) Introduce yourself.

2) Any moment when you worked really really hard to solve a problem.

3) Find the best fit for a packet to be fitted in a rack rack sizes are given in increasing order in other words find the ceil value of a key in sorted array.

5) Find the lowest common ancestor in binary tree
6) If I have any question to ask him

Round 2:

1) Find largest sum contiguous subarray in goven array

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.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.

My Personal Notes arrow_drop_up