Open In App

Amazon Interview | Set 104

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 c e g 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 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

Article Tags :