Round 1 Written Test
Experience :
The online round had 4 programming based questions and was conducted on hacker-earth. The questions asked are:
Q.1) Given two strings, check if they are anagram of each other.
Q.2) You are given 2 numbers, no1 & no2. Reverse both no1 & no2, add them up and take the reverse of resultant number. Output the final resultant number.
e.g. no1 = 12
no2 = 36
Output = Reverse(Reverse(12)+Reverse(36)) = Reverse(21+63) = Reverse(84) = 42
Q.3) You are given a matrix of size mXn consisting only of 0 & 1's.
The number of 1's in the any row of matrix is equivalent to row index of that matrix. All 1's occur at the start of matrix and thereafter trailing 0's follow. We have to find the total number of 1's in sub-matrix of size rXc .
The 1-1 index pattern is followed i.e. first row and col is index as 1,1
e.g.
Given: 3 5
From the given matrix, we can conclude that matrix would look like
Index 1 2 3 4 5
1 1 0 0 0 0
2 1 1 0 0 0
3 1 1 1 0 0
Now, for Input 3,2 , we will have sub-matrix as
Index 1 2
1 1 0
2 1 1
3 1 1
Total number of 1's in sub-matrix = (1)+(1+1)+(1+1) = 5
Q.4) For any given string, we have to find total maximum cost for processing the string. Sadly, I don't exact remember how the given cost was being calculated.
Tips :
When writing code, do think of corner cases. Even if you are not able to able to derive complete logic, write the code for partial part which you have derived. For each question, there are numerous test cases out of which some are simple and very few has corner cases included. So, even partial completion of test cases help you to yield better marks.
Round 3 Technical Interview
Experience :
There were two different interview round to judge the candidate algorithm skills and approach towards the problem.
Interview Round I
The interview was telephonic based and I was asked 6 questions in total. 3 from DS/Algo, 2 Puzzle based problem and last abstract based question
Q.1) Given a sorted array of random integers, find two numbers whose sum is equivalent to some number, let's say k. Then she modified the question as given a sorted array, find three numbers whose sum is equivalent to 0.
Q.2) Given a singly linked list, reverse it using recursion.
Q.3) For given any two nodes in a binary tree, find the number of nodes lying between them.
Puzzle Based Problem:
Q.4) There are three baskets sitting next to each other on a high shelf so that you cannot see the contents of any basket. Under the first basket is a sign that says APPLES. Under the second basket is a sign that says ORANGES, and under the thrid basket is a sign that says APPLES AND ORANGES. Each basket is incorrectly labeled. One basket contains all apples, one all oranges, and one a combination of apples and oranges. Is it possible to reach up on the shelf and without looking into any of the baskets select one piece of fruit and on the basis of knowing what that piece of fruit is correctly label all three baskets? Explain your reasoning.
Q.5) Gold coin weighs one gram, counterfeit coin weighs 1.1 grams. You have 10 bags full of coins, nine of the bags are full of real gold but one bag is full of the counterfeit coins. Given a perfect scale (a pointer scale, for example) and ONE weighing can you determine which bag has counterfeit coins? If so how?
Abstract Based Problem:
Q.6) You are in a semi-constructed building. The building has a lift with a single button which takes you to a random floor. You enter inside the lift and press the random button. The lift takes you to some random floor. Now,without getting out of lift, how will you estimate that on which floor, you are standing right now.
The question was basically meant to test your lateral thinking power during the interview.
Interview Round II
The interview start with one basic question from OS, then carried onto my projects and then gave me a coding based question to code on google doc.
OS Based Question:
Q.1) What do you mean by Zombie Process?
Q.2) Tell me about yourself
Some project related questions
Q.3) Google Doc Based Coding Question
You are given an array of numbers. Based on values present in the array, construct a binary tree.
Input:
Index 0 1 2 3 4 5
Array -1 0 0 1 2 3
In the array, first we will find -1, the index of -1 within the array will be root of our tree.
Tree
0
Then find the root node value within the array. In the given example, they are present at index position 1 & 2.Now 1 & 2 will be our children. As 1 is less than 2, 1 should be our left child and 2 our right child
Tree
0
/ \
1 2
Then, repeat the process for all children, in this case 1 & 2
Final Tree:
0
/ \
1 2
\ \
3 4
\
5
3 become right child of 1 as there is only children of 1 possible. In such case, check if index value is greater than parent or not. If greater, the child would be right child else left child.
The final output should be reverse level order traversal
Output: 5 3 4 1 2 0
Later on, the interviewer modified the problem as if you are required to produce the output without even creating the binary tree at all, how will you do it?
Tips :
All the Interviews went for 1-2 hrs each.Since I had 2.5 yrs experience before going to Amazon,so lots of questions were asked on previous project
Interviews are not stress Interviews.Interviewers consistently help you to get the answer.Bar raiser is the one where you should focus more as if Bar raiser feels you are not better than 50& of existing employees then he can reject you & all other interviews stand null & void.
Try to find more relevant interviewing experience of candidates on Internet as questions & no. of Interview rounds vary for experienced proffesional & a fresher.