Round: Test Experience: Two questions were asked in the written test. It was basically a coding round. 1) 1 / \ 2 3 / \ / \ 4 5 6 7 Output : 1,2 3,7,6,5,4 2) Given a binary tree, check whether a given sum ‘x’ is present along any path from the root to any of the leaves. 1 / \ 4 3 / \ / \ 9 5 6 7 if x = 14 , answer is true because 1+4+9 = 14 if x = 12, answer is false
Round: Other Interview Experience: The initial interview was known to be Data Structures and algorithms round. The two interviewers totally asked me questions on data structures and mostly concentrated on how much I knew about time and space complexities. a) The first question was to find the vertical column sum of every column in a given binary tree and return the result in an array from left to right. The first solution which I told is by finding the leftmost and rightmost index of the array , thereby finding the index for the root. Following to this step, the sum can be stored easily while traversing from top to bottom and saving the value at index1 while moving to the left and at index + 1 while moving to the left. This solution used two tree traversals. He was good with this solution but asked to optimise with respect to time. Then, i shooted out the solution using a doubly linked list where we can traverse to and fro and store all the sum values. While using linked list, instead of index 1 & index + 1 , prev and next pointers can be used to access the next and prev location from the current location. This way , the solution is optimized with time. b) The second question was that I have been given a binary tree where the node structure would be something like below : struct tree { struct tree * left, *right, *sib ; }; Now , the task was to point every sib pointer to its nearest rightmost node in the same level. i.e the sib pointer of the rightmost node at every level would be NULL. The first solution which I told them was to perform a Breadth first search and by using a queue would connect all the nodes of a level at a time. But, this would increase the space complexity and of course I was asked to optimize the solution. Given tree : root > 1 / \ 2 3 / \ \ 4 5 7 The result should be : root > 1 / \ 2 > 3 / \ \ 4 > 5>7 Let me explain the solution which I gave them for the above example. Starting from 1, for any node connect the sib pointer of left node to its right node if both are present or if both are not null. If the left node is not present then no need to perform this operation but if the right node is alone present, then there may be another possibility for the presence of some other nodes at the same level. Here , 2 will point to 3 as explained above. In the same way 4 will connect to 5 . But , we come to know that in the second level there is one more node 3 and it has a child 7 . So , 5 is connected to 3’s right child. In the same way the other nodes would be connected. By this approach, we can understand that before pursuing towards any level, all the sib pointers in the previous level are connected. This solution would work for all the test cases. c) Given two arrays of integers , find the intersection of both arrays. I was asked to give various solutions and sort the solutions with respect to time complexitiy. d) Given a binary search tree with positive integers and a number ‘X’ find the next greatest number to X from the BST. If the number is not present, return 1.
Round: Other Interview Experience: and code for it on paper. The two problems were based on data structures. a) Given a binary tree, find the ancestor matrix where time complexity was considered but not much than the written code. Given tree : root > 1 / \ 2 3 / \ \ 4 5 6 The ancestor matrix is shown as 1 2 3 4 5 6 1 0 1 1 1 1 1 2 0 0 0 1 1 0 3 0 0 0 0 0 1 4 0 0 0 0 0 0 5 0 0 0 0 0 0 6 0 0 0 0 0 0 Let the above matrix would m[][] such that m[i][j] = 1 , where i is the ancestor of j. b) The second question was to swap every consecutive two nodes in a singly linked list. For example given a list 1234567null The result must be 2143657 null For the above both questions , the interviewer saw the code and reviewed it with different test cases to get satisfied.
Round: Hr cum technical Experience: This was a HR cum technical round, but most of the questions were straight forward. The two managers who interviewed me were testing my managerial skillls. Lot of questions arised and the interview went for more than a hour. Few questions were like : a) What do you know about Amazon ? b) Why I preferred Amazon.com to my previous offer ? c) The responsibilites which I undertook during my college days with brief explanations on every responsible task which I did !! d) Any projects which I did apart from academics ?? I explained about my android project which I did with my elder brother. At the end the round ended with a simple technical question => I was asked to design a stack using a c++ class such that it can perform the following functions which will be called by different APIs : Create a stack of size ‘n’ Push an element into the stack Pop an element from the stack Destroy the stack At the end of this round, I asked about their experiences at Amazon.com and about my work/role at amazon in future.
Round: Technical Interview Experience: Coming to the fourth round, it was totally technical. Technical here covers theortical topic from the fields of Operating systems, OOPS and Networks. The questions which were asked were : a) What is the difference between physical address and virtual address ? b) What is page table and paging ? c) What is the difference between thread and process ? d) What is context switch and how it differs between process and threads ? e) What are threads and why are threads preferred to process ? f) What are semaphores and differnce between semaphores and locks ?? g) What are the 7 OSI layers in networks and their functionalities ?? He mostly asked about transport and network layers. h) What is encapsulation ? i) What is polymorphism and their types ?? j) What is differnce between polymorphism and function overloading ?? k) The last question was to design / implement a singleton class . Here this round ended, but I made many sothapals without sufficient preparation :P Interview No 5 This interview was also HR cum technical round but it was known as a bar raiser round. I am not sure how to spell it too. The questions were almost the same as in the 3rd interview with additional questions like “ how did you react in conflicting situations in four year career ? “. This round also ended with technical questions : a) Given a doubly linked list where the next pointer is pointed to the next node in that list but the previous pointer is pointing to any random node. I was asked to make a similar list efficiently . [ Simply a xerox of it ] b) The second question was a string based traversing and pattern matting type where there were given two strings ‘A’ and ‘B’. I was asked to return true if all the characters in ‘B’ were present in ‘A’ or else return false. I explain many solutions in which he asked me to code for a particular solution and he verified the code by iterating though the test cases. The round ended with few personal questions on experience and my future role. So, I was into Amazon after a week of discussions
Round: Test Experience: This interview was also HR cum technical round but it was known as a bar raiser round. I am not sure how to spell it too. The questions were almost the same as in the 3rd interview with additional questions like “ how did you react in conflicting situations in four year career ? “. This round also ended with technical questions : a) Given a doubly linked list where the next pointer is pointed to the next node in that list but the previous pointer is pointing to any random node. I was asked to make a similar list efficiently . [ Simply a xerox of it ] b) The second question was a string based traversing and pattern matting type where there were given two strings ‘A’ and ‘B’. I was asked to return true if all the characters in ‘B’ were present in ‘A’ or else return false. I explain many solutions in which he asked me to code for a particular solution and he verified the code by iterating though the test cases. The round ended with few personal questions on experience and my future role. So, I was into Amazon after a week of discussions :)
Round: Test Experience: 1. An Address book in your mobile has its contacts syncd with the Internet. write test cases for this scenario. 2. Find second smallest element in an array without sorting 3. A Printer is connected to your laptop.But when trying to print a file it doesn’t print properly. i) How will you identify the problem? ii)What steps will you take to rectify them? 4.write a program which should accept and integer and print output as below eg. 1 * 2 * *** * 3 * *** ***** *** * 5. for the code below,analyse and list all possible test cases read p read q if p+q>100 print “large” endif if p>50 print “p large” endif
Round: Technical Interview Experience: Why Amazon? Why Testing? Test case for Mobile phonebook (which was asked in written) Test case for A4 sheet Test cases for Gmail.
Round: Test Experience: Question 1) Maximal Contiguous Sum in an array of +ve and ve numbers write the code ! Question 2) Imagine a Bar Graph ! Fill the Bar Graph with water now ! Find the total area which is covered with water now !
Duration: NA minute Total Questions: 2
Round: Test Experience: Question 1)given a Rotated Sorted array find an element in that array( Simple Binary Search) Question 2)Given a number find the number which is next biggest number which you can construct with the same digits provided in the number Say 678 the next number which is greater than 678 but with same digits is 687 ( 8 and 7 swapped) Say 52430 , the answer is 53024
Round: Technical Interview Experience: 1) Why amazon ? 2) Why should i hire You? 3) what do u know about amazon ? and a Technical question An N-ary Tree is given in form of an array where the array value =parent of array index and array value of root node =1 Find the height of the Tree now ?
Round: Test Experience: 1.Given a billions of words. Find 5 most frequently occurring words? 2.Given an array which consists of elements in the following form : -->All the adjacent elements differ only by value 1 or +1. -->You are given an element. You need to search for its index. 3.Given a binary tree with left and right pointers.Convert it to double linked list? Duration: NA minute Total Questions: 3
Round: Test Experience: 1.Least common ancestor 2.Given a railway station and number of trains with starting and ending times. You need schedule the trains such that minimal number of tracks should be assigned.
Duration: NA minute Total Questions: 2
Round: Test Experience: 1.How to implement T9 dictionary?write code for that. 2.Find the vertical sum of a binary tree. Ex: 5 / \ 7 9 /\ / \ 3 1 4 6 3)Here, there are 5 vertical paths sums: > 3 > 7 > 5+ 1+ 4 > 9 > 6 Implement it with one traversal? Duration: NA minute Total Questions: 3
Round: Test Experience: 1.Implement stack such that we can find maximal element of current stack in O(1) time. 2.Given a matrix of zeros and ones. If any of the row containing 0 make that row fully as zero.Do the same for columns also.Minimize the space complexity of auxiliary array to do this