# Amazon interview experience | Set 397 (On-Campus)

Online Round:

It consisted of 20 mcqs and 2 coding questions. The test was hosted on HackerEarth.

1. Given a string. Find all the palindromic partitions of the string. (Number of way the string can be partitioned so that all the partitions are palindrome)

`   Input: NITIN     Output: 3`

2. You are given with a large paragraph and N words.You have to find a min length subparagraph of the paragraph which contain all those N words in any order.

Round 1 (35-mins):

The interviewer started with the most common questions “Tell me about yourself” , in which I explained my projects , my achievements and my strengths. I was asked 2 questions from ds and algo in this round.

1. Find all the hero and super hero in an array. Hero – Elements which are greater than all the elements on its right side. Super Hero – Elements which are greater than all the elements on its left and right side (Largest Element of the array which should only occur once). Expected Complexity – O(1) space and O(n) time in single traversal.

```Input: {1,6,5,4,7,8,4,3,2,1}
Output:  Heroes : 8 4 3 2 1
Super Heroes : 8
```

2. http://www.geeksforgeeks.org/find-the-smallest-window-in-a-string-containing-all-characters-of-another-string/

Round 2 (60-mins):

I was asked to introduce myself asked about my strengths and my weakness. Like last round I was asked 2 questions on data structures and algorithms.

Discussions on projects for 15-20 minutes.

1. Find Maximum number possible by doing at-most K adjacent swaps. Expected Time Complexity – n*K and space complexity – O(1)

2. Find the closest pair to a given sum in an unsorted array. Approaches – Brute force, Sorting , Ceil and floor using BST.

3. Memory Allocation in C++. How to allocate double memory in c++. Couldn’t Explain this.

Was called for 3rd round after 5 mins.

Round 3 (90-mins):

This round was purely on algorithm design and data structures.

1. http://www.geeksforgeeks.org/design-a-stack-that-supports-getmin-in-o1-time-and-o1-extra-space/

Couldn’t derive this for O(1) space.

2. http://www.geeksforgeeks.org/how-to-determine-if-a-binary-tree-is-balanced/

3. http://www.geeksforgeeks.org/minimum-number-of-jumps-to-reach-end-of-a-given-array/

Explained O(n^2) dp approach. Gave a segment tree approach of time complexity O(nlogn) , space O(nlogn).

4. http://www.geeksforgeeks.org/find-first-non-repeating-character-stream-characters/

Implemented using Double Linked List and Hashmap.

Was called for the final round after 5 mins.

Round 4 (30-mins):

The round started with discussions on Operating Systems and Compiler Design.

Operating System Questions-

1. What is caching ?

2. Where does cache lie in operating system ?

3. Difference between associative mapping and direct mapping in cache.

4. What is spooling ?

5. Applications of spooling.

Compiler Design Questions –

1. What is lexical analysis ?

2. What is semantic analysis ?

3. What is a Deterministic Finite Automata (DFA) ?

4. Difference between DFA and NFA ?

Exhaustive discussion on my current projects.

Finally 3 questions were asked on data structures and algorithms.

1. http://www.geeksforgeeks.org/minimum-time-required-so-that-all-oranges-become-rotten/

2. http://www.geeksforgeeks.org/fix-two-swapped-nodes-of-bst/

3. http://www.geeksforgeeks.org/bottom-view-binary-tree/

Verdict : Selected 🙂

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

# GATE CS Corner    Company Wise Coding Practice

4 Average Difficulty : 4/5.0
Based on 4 vote(s)