Open In App

Amazon Interview Experience | Set 388 (On -Campus for Full Time)

Last Updated : 11 Jul, 2019
Like Article

Round 1: Online coding test – 90 minutes (HackerEarth)

It had 2 coding questions and 20 MCQs.

  1. Knapsack variation(you can choose an item any number of times) GeeksforGeeks Link
  2. Given a 2D array consisting of 0’s, 1’s and 2’s. 1 denotes a fresh apple, 2 denotes a rotten apple and 0 denotes absence of an apple at that position.
    Each rotten apple takes 1 day to make its neighbors (8, given a fresh apple, is already there) rotten as well. Calculate the number of days when all the apples will be rotten. If not, then print the number of apples which will never get rotten.

MCQs included some output based questions in C (5), time complexity (2), data structures (10), OS(2), Java-based output question(1), etc.

Round 2 (F2F1)
The interviewer was very chilled and asked me to introduce myself, then he asked me to explain any of my projects. He then asked me two questions:

  1. Given a special binary tree, find the height of the tree.
    Specialty: each leaf is connnected to the next leaf(left to right) in a circular doubly linkedlist fashion.
    fashion. Let’s say the 2 consequtive leaves are A and B, so, A->right = B and B->left = A. The leftmost leaf’s left points to the rightmost leaf and the rightmost leaf’s right points to the leftmost leaf.
    Expected time complexity = O(n), space complexity = O(1).
    GeeksforGeeks Link
  2. Flip maximum k bits to find the maximize the number of consecutive 1’s in a binary array.
    Expected time complexity = O(n), space complexity = O(1).

Round 2 (F2F2)
He started with a description of my projects and then he asked me several questions, majorly:

  1. Next permutation of a given string(can contain duplicates). (Write complete code including swap, reverse etc).
    GeeksforGeeks Link
  2. Find the mirror the a tree in which each node can have any number of children. (Write complete code)
    GeeksforGeeks Link
  3. Boundary order traversal.
    GeeksforGeeks Link
  4. Check if the given 2 nodes are cousins or not.
    GeeksforGeeks Link
  5. Check whether a given tree is a summation tree or not. (Any node’s value = sum of all it’s children’s value).
    GeeksforGeeks Link

Round 3 (F2F3)
She started with a description of my projects and then he asked me several questions, majorly:

  1. Difference between recursion and iteration(slightly long discussion).
  2. Difference between array, linkedlist and trees.
    GeeksforGeeks Link
  3. Discussion on all O(n logn) sorting algorithms.
  4. Sort an array consisting of 0, 1, and 2’s only in one pass.
    GeeksforGeeks Link
  5. Given 2 arrays which denote the elements to be inserted in two separate binary search trees. Find whether the two binary search
    trees will be same or not, without actually constructing the tree.
    GeeksforGeeks Link

            Eg: 2 3 1
                2 1 3
                Ans = Yes.
            Eg. 1 2 3
                3 2 1
                Ans = No. 
  6. Normal forms in DBMS.
  7. Difference between threads and processes. Also, between multi threading and multi processing.
  8. Return a random node from a given binary search tree and also find the k’th smallest value in the tree(can change the structure)
    GeeksforGeeks Link
  9. Spiral order traversal in a square matrix.
    GeeksforGeeks Link
  10. Find an element in a sorted, rotated array. Expected time complexity = O(log n).
    GeeksforGeeks Link

Round 4 (Telephonic + screen share)
He also started with an description of my projects. Then he just asked one question.

  1. Given an array, find the number of inversions in the array.GeeksforGeeks Link

The call quality and the internet connection was poor. I wasn’t able to explain my solution(recursive) on the phone call.
Then I wrote the code on the shared screen. He asked me to dry run it on a case. Just when I was about to dry run I encountered a 502 Bad Gateway error. Nevertheless, he could still see my code and asked me questions on some of the things
in my code like the use of “and” instead of “&&” and declaration of array like int temp[n] and not using malloc
(Specifically: why malloc, if you can declare an array like this?). Later, I could not hear him properly so he decided to end the interview here itself.

Related Practice Problems

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads