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

• Difficulty Level : Hard
• Last Updated : 11 Jul, 2019

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`

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
```

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. Special stack

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

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

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. Minimum time required to rot all oranges

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

3. Bottom View of 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.

My Personal Notes arrow_drop_up