Tip 1 : Practice at least 250 Questions, Give yourself enough time for preparation. Cramming won't take you very far. In books, I really liked Elements of Programming Interviews.
Tip 2 : Make sure to brush up your basics - coding style, OOPs, Language features. They help in making an impression.
Tip 3 : Don't worry about solving the question in the interview. Learn to tackle any random problem with the best of your ability. More often than not, that'd be enough.
Tip 1 : Keep your resume clean - no graphics, no multiple fonts. Keep it one page.
Tip 2 : Don't go over board in mentioning skills, only mention the things you are truly confident about.
Around 65-70 people sat for the test. 15 people were shortlisted. It consisted of the following to be done in 90 minutes.
- 28 MCQs based on core CS
- 2 Coding questions – everyone had different and random questions. Most questions were custom logic based (easy level) including some standard questions – LCS, LIS, topological sort.
28 MCQs based on core CS – trees, BFS, DFS, C++ outputs, stacks, queues. If you’ve prepared for placements, you’ll get through them pretty easily. If unprepared, it will be challenging to go through them within the allotted time.
Interviewer was very friendly. It started with the standard – tell me about yourself / introduce yourself type of question. Then he proceeded and asked two coding questions



Input: Linked List: 1 <-> 2 <-> 2 <-> 2 <-> 3
Output: Modified Linked List: 1 <-> 2 <-> 3
Explanation: We will delete the duplicate values ‘2’ present in the linked list.
Pretty Straightforward. Standard linked list question. I discussed approach with the interviewer. Then coded out the solution.



If N = 2 and prerequisite = [[1, 2]]. Then, there are a total of 2 courses you need to take. To take course 1 you need to finish course 2. So, it is possible to complete all courses.
I clarified in which format is the input, output, etc as it is a graph based problem.
This is a standard topological sort problem. I first explained overall approach then coded them on paper.
This round had only 1 question. The interviewer introduced himself. And he advised me to clearly understand the problem before proceeding.



You may assume that given ‘X’ and ‘Y’ definitely exist in the given binary tree.
For the given binary tree

LCA of ‘X’ and ‘Y’ is highlighted in yellow colour.
Since this was a new question for me, I tried to stay calm and decided to tackle the problem to the best of my ability without thinking about the end solution. I started building on observations - heap like structure of tree, resemblance to lowest common ancestor.
The solution was as follows -
- To count nodes in path, we find lowest common ancestor. Then we can use that ancestor to reach our input nodes, and count the black nodes in path.
- How can we find the lowest common ancestor? Since it is a heap like structure, i can get the parent node number using mathematical formula like heap. Now i have sort of a way to reach the parent.
- The problem decomposed to finding lowest common ancestor using these parent links. Then i reached the parent.
- And so on.
Took me around 30-40 minutes maybe. Then I coded it on paper. The code was hardly 10 lines surprisingly.
Pretty Good Round. Fast Paced. We covered a lot of ground.



1. BSTIterator(Node root) - It is a parameterized constructor in which you are given the root of the Binary search tree. It will be called whenever an object of BSTIterator is created.
2. next() - This member function will return the next smallest element in the in-order traversal of the binary search tree. You need to implement this function.
3. hasNext() - This function will return true if there exists the next smallest element in the traversal else it will return false. You need to implement this function
I engaged the interviewer. Established that we'll need controlled inorder traversal. That will need iteration, and we'll abstract it in a class.
For this question, it's important that you are well versed with iterative solution of tree traversals. It's very hard to come up with a clean code for iterative traversal on the spot.



I explained that a sliding window approach would work. The approach was easy, discussed it with interviewer. Then coded the solution.



The traversal should proceed from left to right according to the input adjacency list.
Adjacency list: { {1,2,3},{4}, {5}, {},{},{}}
The interpretation of this adjacency list is as follows:
Vertex 0 has directed edges towards vertices 1, 2, and 3.
Vertex 1 has a directed edge towards vertex 4.
Vertex 2 has a directed edge towards vertex 5.
Vertices 3, 4, and 5 have no outgoing edges.
We can also see this in the diagram below.
BFS traversal: 0 1 2 3 4 5

Standard BFS of a graph. Interviewer was just checking my skill in graphs. Coded on paper.



Input:
4 5
0 1 5
0 2 8
1 2 9
1 3 2
2 3 6

In the given input, the number of vertices is 4, and the number of edges is 5.
In the input, following the number of vertices and edges, three numbers are given. The first number denotes node ‘X’, the second number denotes node ‘Y’ and the third number denotes the distance between node ‘X’ and ‘Y’.
As per the input, there is an edge between node 0 and node 1 and the distance between them is 5.
The vertices 0 and 2 have an edge between them and the distance between them is 8.
The vertices 1 and 2 have an edge between them and the distance between them is 9.
The vertices 1 and 3 have an edge between them and the distance between them is 2.
The vertices 2 and 3 have an edge between them and the distance between them is 6.
1. There are no self-loops(an edge connecting the vertex to itself) in the given graph.
2. There can be parallel edges i.e. two vertices can be directly connected by more than 1 edge.
I tried to tackle the problem with every graph algorithm i knew. After some struggle, he hinted to expand the weights, then the problem broke down to BFS.
It was a little unusual problem. We just discussed this, no code.
A couple of DBMS questions -
- What database have you worked on.
- Can you tell me what normal forms are?
- Can you explain me a few normal forms
- Diff between sql and nosql
- Example of nosql databases? Example of nosql databases of amazon
Tip 1 : Sharpen your basics before the interview day. Go through tutorial point subjects on DBMS, OS, Networks
Bar Raised Round. Definitely felt the difficulty.
The interviewer’s style was very different from others. Discussion started as follows -
- Tell me about yourself
- Tell me your best project from resume
- What did you do in this
- How is it different from any other similar project
- How did you assure code quality in your project
- How do you define code quality
- How did you test your code
- Did you write test cases for your code
- Write down test case for this code ( he gave a code )
He took each point very seriously, and did counter arguments for some of these.
- Then he asked me which app do I use for music.
- Lets design a database for an app.
- So I wrote a basic schema. He then picked up on the details. A bit of discussion.
- Then we moved to a specific table.
- Why is this table like this
- Do you think that app uses it like this
- Do you think its scalable
- What can you do to make it scalable
- What should you do to make it scalable
- Think about more use cases, develop a generic db structure which can accommodate some of future changes.
- A little discussion about development methodologies - ( plan a lot of use cases and then make database schema ) or ( deliver fast and re-iterate ).
Tip 1 : Stay calm under the pressure. It's okay to not know the correct solution to every question.



I tried tackling the problem through various angles. Was able to make a minor dent in the problem.
We just discussed the approach. No code.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?