Skip to content
Related Articles

Related Articles

Improve Article

Amazon Interview | Set 104

  • Difficulty Level : Medium
  • Last Updated : 20 Jun, 2019

Online round:
20 MCQs on mathematics, probability, operating systems, DBMS, compilers and basic DS concepts.

Coding questions (Full code required):
1. Given an array containing zero and non-zero elements, modify the array such that it has the 0’s at the end and the non-zero elements at the beginning. Print the number of swaps required and the number of non-zero elements.

2. Given a ‘pattern’ and a ‘text’ print the indexes of ‘text’ where any anagrams of ‘pattern’ occur.

  Input:
    abcdad (text)
    abcd (pattern)
  Output:
    0, 1 


1st technical:

1. Given a linked list reverse the even nodes in one pass and in O(1) space.
So 1->2->3->4->5->6->7->8 should be converted to 1->8->3->6->5->4->7->2.

2. Given an array containing integers, modify the array such that the 5’s are at the end and the rest are at the beginning (maintaining the same order).



2nd technical:
1. 5 minute discussion about my OCR project.
2. Given an undirected graph, count the number of cycles with 3 nodes.
3. What is a spanning tree? Difference from tree, if any.
4. How to find the minimum spanning tree of a graph?
5. Given an array convert it to another array such that the following condition holds:
a < b > c < d > e < f > g < h where the modified array is {a,b,c,d,e,f,g,h} Input: 1,2,3,4,5,6 Output: 1,3,2,5,4,6 3rd technical:
1. What do you know about memory management in Operating Systems? What is segmentation? What is paging?

2. Design problem: Given a station with n platforms. So each platform has one line. But these n lines join into one, after leaving the platform (on both sides). Each train has to wait a minimum of x minutes in the platform. Trains arrive from both ends. If all the platforms are occupied they wait. There is also a point beyond the end of the platform (on both sides). This point indicates that an incoming train has to wait at that point until a leaving train (from that end) passes that point. Design the whole system.

3. How are big files stored in memory? What are the uses of B-tree? How is it more useful than BST?

4. Given one billion file indexes and said that n files are missing. How would you identify the file indexes of those who are missing?


4th technical:

1. Given an array of integers. This array denotes ‘our’ own ascending order of the elements. So if the array is {2,3,1,4}, by mathematics we can say that 2<3<1<4. Given another array, sort this new array in ‘our’ ascending order. Let’s say the new array is {1,2,4,3,5,4,9,2}, output will be {2,2,3,1,4,4,5,9}. Note that since 5 and 9 do not occur, they are sorted by actual ascending order at the end. 2. Integers are coming in a stream. A special integer (say -9999) denotes reset. Design a data structure such that when the special integer comes the previous elements are printed in a zigzag way and all the elements are deleted (reset). And then continues to accept other integers. What DS will you use?

Say the input is
 1,2,3,4,5,6,7,8,-9999,0,1,100,-9999,-9999,500
Output will be
 1,8,2,7,3,6,4,5
 0,100,1

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
Recommended Articles
Page :