Interview Experiences

Amazon Interview Experience Set 2


CTC: 28 LPA

Profile: Software Development Engineer

Mode: Off Campus


Round 1: Paper Coding

3 Coding questions

Question 1:

Given two linked lists each represents a number, write a function that returns a linked list that represents sum of two numbers represented by the given linked lists.

Ex:

123 represented as 1->2->3

456 represented as 4->5->6

o/p: 579 represented as 5->7->->9

Question 2:

Given an array find if sum of any two numbers in the array is zero

Quite easy

Question 3:

Next greater number with same number of digits

Very famous question


Round 2: F2F

Question 1:

Given a string and an array of string that represents a dictonary, count and print all the anagrams of the given string that exists in the given dictonary

asked me to write production ready code. Remember in amazon interviews always write error free code that can handle all the edge cases.

Question 2:

Given a tree and address of a node in the tree, find all the nodes that are at k distance from the given node

wrote full code, some minor edge cases were not handled in first attempts so he asked me to find those and correct the code.

Even in second attempt code was not handling all the cases he asked me to do it again

Third attempt still some cases were missing

In Fourth attempt he was satisfied, some errors were there but he was satisfied

So Never Give Up


Round 3: F2F

Question 1:

Given a linked list where each not has 2 pointer fields one nextPtr for next node and 1 randPtr that points to a random node. Create a copy of the given list but you can not modify the given linked list.

Write code on paper that should handle all the cases.

He asked me to dry run the code.

Question 2:

Reverse the given sentence word by word.

Easy approach

Question 3:

Given a BST find the distance between two given node(by value), handle all the cases if value is not present in the tree.

write the code and dry run it.


Round 4: F2F

Project discussion (45 min)

Tips: Prepare your project in such a way that when you explain interviewer should be able to understand it. First explain what the project is and how it works(just overview). If he asks then only go for code or class diagram.

He found my project interesting so arround 40-50 min he was discussing on project only that too without single line of code.

Question 1:

Given an array and a empty tree, insert the array elements in the tree such a way that it should become a BST

Handle the cases if no of nodes in the tree are more then array size and vice-versa

Asked me to write code on paper and dry run it.


Round 5: F2F

Project discussion(30 min)

Question 1:

Given a grid with zero and ones where find the sortest path between given two cells where you can travel over ones only

This questions took very long time, I gave him approach he modified the questions, again I gave him approach he modified the question. He repeated this for 4 times.

Question 2:

Given an expression like 3+5*6/4+0-4/3 evaluate it.

I told him it can be solved by stack after converting it into pospix

He asked me to write the code for it, I was not able to re-call exact algo but I explained him whatever I had figured out from 2-3 examples, he was satisfied.

Question 3: (worst question of the interview process)

He confused me alot with the question either I was not able to understand well or he was not explaining properly.

At last question was, Given a family relation ship as input:

A B Father
B C Brother
E C mother

Design your own data structure to store this family relation and answer the query print all the members who has only one grand parent and exact 4 child.


PS:

  • Prepare your project very well
  • Discuss whatever the approach you think for any question, they do not expect you to give exact solution. They only see how you solve the problem



comments powered by Disqus

Stay in Touch

Like us on Facebook to stay up to date with updates and news