Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Round 1 Written

There were 20 MCQ and 2 coding questions. The MCQs basically comprised of
questions on OOPS, OS and C etc.
The two 2 codes were:
1. Mirror of a Binary Tree.
2. Check if there are two numbers a, b with sum equal to K.
Round 2 Telephonic Interview
1. In an array of size of n+1, with values ranging from 1 to n find which
number is repeated. I did it easily using the sum.
He then asked lets say the size of array is N. This time the numbers lets
say N
i
(0 < N
i
< N+1) can be present multiple number of times or not be
present at all. So in O(n) Time complexity and O(1) space complexity give
the occurrences of all numbers in the range 1 to N.
For ex:- array : 6 ,3, 2, 4, 2, 3, 5, 2. So occurrences are 1 -> 0 times, 2 ->
3 times etc.
I did it by using the array indexes as numbers and the value as their
count and traversing the array by cycling through the numbers and
updating the visited numbers. He asked to write the code.

2. Find the Diameter of a BST. Simple GFG question gave him the algo and I
didnt want to write the code so I tried to be a little cocky by telling him I
knew this question and its pretty easy. He did not ask for the code.

3. Search for a number in a matrix sorted by row and column both. Simple
GFG ques, easily done in O(n) by starting with the top right and moving
down column-wise and then left row-wise. Surprisingly, he asked me to
give him the algo for O(nlogn) and O(n
2
) even after I gave him an
approach for O(n). ( and Yeah, he asked me the code for brute force as
well ).

4. Design Question: Describe the data structure you will use for a Media
Player, which requires a functionality that the song that is playing now
has to be appended behind in the list after it has played completely.
Gave linked list as the answer, he gave other functionalities as well like
playing any song from the list not necessarily the first one, etc. had a
long and boring discussion.

I got the call that I qualified for the Onsite Interview after a week.

Round 3 Onsite Interview 1 Senior Developer and Manager
The interview happened almost 1 and a half months later, because the HR was
on a holiday. First round both a senior developer and the hiring manager were
present. The manager was shadowing the other guy probably because it was
his first interview.
Started with Some HR questions from the manager and then to the tech part
with the developer.
1. Find K smallest numbers from N numbers. I started off a little nervously
mostly due to the hiring manager breathing down my neck looking at the
code I was writing. I gave him several approach like sorting, Hashing,
using the pivot element. I wrote the code by using the pivot element and
decreasing our search space for Kth smallest element which can be used
to find the K smallest elements.

2. Given two strings find if they are anagrams of each other or not. He
later changed it to two big files. This was easy, you can either sort and
check which will have a higher time complexity or use an array of size
255 for checking which numbers occurred in one string and other too. I
wrote the code for this too. Keep in Mind, they kept on telling me we
want a production code with no errors and all base cases checked. I was
able to do this, and this mightve been a plus point.

Round 4 Senior Developer
1. Given a BST, modify it in-place such that a particular node is always
equal to the sum of itself and the nodes with value greater than that.
Restrictions posed were you cant use a static variable or a reference to
a variable in the code. You can do that easily using the return value to
update the sum starting from the rightmost node. Again Code was
asked.

2. You are given a File and a String find all the occurrences of that string in
the file. Gave an approach using DFA. The discussion went into FAT with
questions related to NFA and DFA etc. Finally gave the code in O(n) Time
complexity. My solution wasnt generalised so he asked me to do that, I
used a state transition table for that.

Round 5- Hiring Manager
This was mostly an HR round. Half the time discussion was on HR question
where do you see yourself in 5 years. Why dont you pursue PhD? Etc.
He went into tech questions after that starting with the Projects I had worked.
He enquired about them thoroughly. And then went to basic tech and
programing skills.
1. Given an array with numbers occurring twice and one number occurring
thrice how will you find that number?
2. What is a balanced Binary tress? ( This is where I made a blunder. I got
confused with complete binary tree and told him about that). He then
asked to write a code to verify if a tree is balanced or not. Midway
through the code I realised my mistake and apologized telling him I got
confused. He seemed ok with it, but I thought he shouldve kicked me
out then and there.
3. Some basic OOPS questions. What is a template class? What is a base
class? When is template class useful rather than a base class?
4. Difference between Process and thread.
After two days I got the call I had cleared the interviews and will be heading to
Hyderabad for the final Managerial Round.
Round 6 Managerial Round (BAR RAISER)
I came in thinking it will be a standard HR cum tech managerial round. The
person was a manager of a different team and told me hes not the Hiring
manager and this is a tech round.
1. You have an arithmetic expression. You have to verify if the parenthesis
are correct or not, with a condition that [] encloses (); and () encloses {},
so {(a+b)} is wrong. Gave an answer using stack and keeping in mind the
levels of stacking.
He then modified it. Now suppose you have an array of size 2n. and an
arithmetic expression as a string as input. The array contains the
parenthesis, where the element at i
th
index is the opening bracket and
the i+1
th
index is the closing bracket. And A bracket lying earlier in the
array can enclose a bracket lying later in that array but vice versa is not
true. Now check for the correctness of the parenthesis.
I gave a solution using hashing and applying an indexing approach and
using a means similar as the previous solution. He asked me to code it.

2. You have N rectangular plates of length L
i
and Breadth B
i
. Now you have
to stack them up in a pyramid form with condition that a Plate N
i
can be
stacked over a plate N
j
only if L
i
< L
j
and B
i
< B
j
. Find the size of the
maximum Pyramid you can create. I gave an approach where I sorted
the plates according to the lengths and then moved bottom up passing
on the information of how many plates can be stacked over it. Using the
previous solution. He was satisfied with it. He asked me to write the
code again.
He then modified it saying lets say rather than plates these are cuboids
with similar conditions. I gave an approach which took O(n
2
) using
similar method as earlier. I gave a greedy approach too but quickly
retracted back as it will give a wrong solution.

3. You have an array containing 0s and 1s. You have to fill up the array
again in a Fibonacci manner, i.e 1-> 1s, 1-> 0s, 2-> 1s, 3-> 0s, using the
number of 0s and 1s present in the array earlier. You have to do it in
O(n) and O(1). Gave an iterative solution of finding Fibonacci and filling
up the array according to the turn and the amount.

That was it. I got a call 3 days later, I had been selected!

You might also like