# Amazon Interview | Set 51 (On-campus for SDET)

Hello Everyone!! Recently, I have been through the interview experience of Amazon India and I would like to share my experience with everyone.

Position : SDET

No. of Interviews : 1 Written + 4 PI (3 F2F and 1 telephonic)

Suggestions : Your code should be optimal, have proper variable naming, consider all corner cases and should not be lengthy.

Round 1: (90 minutes)
20 MCQs and 2 coding questions

Coding questions :
1. A string consists of parenthesis and letters. Write a program to validate all the parenthesis. Ignore the letters.
eg. ((alf)ls) – valid
)(dkk)() – invalid

2. You are involved in a betting game whose rules are as follows :
a) if you win a round, the bet amount will be added to your sum and next bet amount will be \$1;
b) if you lose a round, the bet amount will be reduced from your total sum and next bet will be twice the previous.
c) game ends when all the rounds are complete or you dont have sufficient sum.
Initially, you are given with a string of the form “WLWWL” where W indicates a win and L indicates a loss and initial sum. Initial bet amount will be \$1.
You need to find the amount at the end of the game.
Function prototypes and main was given for both questions

Round 2: (face to face) (1 hour 15 min)
1. Given a 2d matrix in which rows are sorted in ascending order and columns are also sorted in ascending order .I need to find an element in optimal time complexity

2. In the same (M X N) matrix I have to print the matrix in increasing order of elements .write code for it(I used heap for that purpose and used concept of merging k sorted array).
3. Given an array , each element is one more or one less than its preceding element .find an element in it.(better than O(n) approach)

4. Given two strings STR1 and STR2 .we need to find longest substring in STR1 whose all characters are taken from string STR2(was asked to write code for it in optimal time)

```    STR1-abcdefacbccbagfacbacer
STR2-abc
ans : length : 7
acbccba  (from position 7 to 13) ```

5. Given a binary tree. I need to print the nodes in vertical line zigzag manner. For example: 1st vertical line from top to bottom, 2nd vertical line from bottom to top,3rd vertical line from top to bottom and so on

```                       5
/     \
3       7
/ \     / \
1   4   6   8
/    \     \
2       9    10```

1
2 3
5 4 6
9 7
8
10

Round 3: (face to face ) (50-60 minutes)
I was asked about my project in details. He asked me project related questions for first 20 minutes.
Next he asked to convert a binary tree in a doubly link list.
I told him various approaches like by using space complexity and in-place conversion.
I was asked to code all those approaches.
Then he gave a hint about one more approach and asked to code it.

Round 4: (face to face) (60-70 minutes)
Again, I was asked about my project in details and he was questioning me on every part of it. Next he asked me to name the subjects that I have studied so far 🙂 . He asked many theoretical questions on database management systems, SQL, operating systems, OOPs concepts and their real life examples and also two coding questions.
1. Code for dfs of a tree(tree can be any general tree)
2. Print pascal triangle and your output should be same as pascal triangular form (have to consider the space separation) .I told him two approaches and wrote the code.

Round 5: (telephonic) (1 hour 30 min)
For first 40 minutes he asked me about my achievements, about amazon company, my project in details and what problems I faced in project and how I resolved them. next he asked one coding question.
1. Find the square root of any number (square root can be a real number) without using any library function .
I told him an approach using Newton-Raphson method. It was faster but he asked simple and optimal method so then i suggested binary search method ( O(log n)) and I was asked to code it and dictate and he ran the code on his system also.

Finally, I was hired with three of my friends. 😀 😀 :

Many many congratulations to the author. 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.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.