MakeMyTrip came to our campus BIT Mesra on 12th August, 2019.

First round was a coding round. 2 questions (one of 100 marks and another of 50 marks) and 20 mcqs were there.

Q1. You are given an array of numbers and for each **ith** element in the array you have to calculate the absolute difference between the count of numbers that are to the left of **i** and are greater than **ith** element, and the count of numbers that are to the right of **i** and are lesser than **ith** element? (50 marks)

Ans. I used segment tree twice (first time by sorting the array in ascending order to calculate all count of numbers that and second time by sorting the array in descending order) to solve it using something like the concept of inversion count.

Q2. You are given a tree with **N** nodes and **Q** queries. Next line contains **N** integers representing the color associated with each the **ith** node. For each query you are given a node number. Now you have to mark all nodes as special which are in its subtree and have the same color as this node. Once a node is marked special, it remains marked as special in the subsequent queries. So for each query you have to output the number of special nodes in the tree?

Ans. I simply applied brute force approach and 9 out of 10 test cases passed XP. I kept a **visited[]** array and kept a global **count** variable for counting the number of special nodes. So for each query I just traversed the subtree of that node and checked if it has the same color and visited[node] is false, if it is so then I incremented **count** and marked visited[node]=true. Then I output count.

After this coding round, 21 people were shortlisted ðŸ™‚

**Interview Rounds**

**Round 1:**

In this round they asked me two questions one was a SQL query and another was related to digit dp.

**SQL question:** They gave me a table which consisted of some id and Booking_amount. Now my output should contain the count of booking_amount in every 500 range.

Eg:**Input:**

Pid | Booking_Amount |
---|---|

1 | 20 |

2 | 100 |

3 | 510 |

4 | 1020 |

**Output:**

Min | Max | Count |
---|---|---|

1 | 500 | 2 |

501 | 1000 | 1 |

1001 | 1500 | 1 |

I didn’t know how to do this kind of query so i kept on trying but i wasn’t able to do it finally I told them that if i had the range then we can use aggregate function to calculate the count.

**DP question:** I had to count the number of ones from 0 to a given integer.

I told them the brute force approach and the digit dp approach and they first told me to write the complete code on paper but after sometime they told me to run my code on an ide.

**Round 2:**

In this round he asked me about my hobbies, I told them that i play dota 2 and that i had spent 2000+ hours in it XP, he then asked me about my projects and then asked me few questions related to it like why i used mongoDB and not SQL (this question is asked in almost all the interviews so i was already prepared with my weapon XD). Then he gave me a system design kind of question (for which I had no idea). He told me that i have to design a system in which the user inputs a source and his amount and I had to output all the destination that he can visit, stay and return back using only that much amount. He told me that I had to tell him everything that I needed and the approach and algorithms that i will take in order to implement this.

I first started with all the databases that i will need and which data structures i will use and finally told him that when a query comes i will search the total cost in all the databases an output the destination and store it in a map and next time when have the same query i can output this saved destination(so u see i didn’t had any technical knowledge but i kept on trying and kept giving them solution for every situation instantly, they basically wanted to see how fast and how creatively i can think of a solution to some unknown problem)

Then he gave me a simple question.

In a certain city all lowercase letters are mapped in the following manner.

1 -> a

2 -> b

3 -> c

.

.

.

26 -> z

Now a stream of digits is coming and i have to output the number of ways it can be represented as letters.

Eg: A Stream is coming and i have to output after each digit in the following way

**Input:** 3**Output:** 1

**Explanation:**

3 -> c

**Input:** 2**Output:** 2

**Explanation:**

23 -> w

or

23 -> bc

**Input :** 1**Output:** 3

**Explanation:**

123 -> abc

or

123 -> lc

or

123 -> aw

i used something like fibonacci series to solve this.

**Round 3:**

In this round he told me that i had to design a scoring system in which i had to output top 100 participant’s score. I told him that i will use min heap to store it. And thent he asked me many questions like around 10 to 12 related to this question XD like modifying some situations like suppose if a person A is friend with a person B then A’s final score will be sum of both of their scores and similarly for B then i had to calculate the top 100 scores.

Again as i already told he just wanted my see your pace of thinking and the way you approach a new question.

This was my best round as i answered almost all the questions and almost instantly XD

Just a tip try to answer as fast as possible though if it is some brute force and try to give different optimised approaches for all the questions.

**HR Round:**

This was the final round. In this the HR asked me about my background like my family, my hobbies, my strengths and weakness. She then asked me if i had any questions for her. So i asked her about the compensation ($$$) XP.

The whole process took around 13 hours from 10:00 am to 11:00 pm (O_O)

Finally 7 people were selected out of the 21 people and obviously i was one of them XD .

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer **Complete Interview Preparation Course****. **In case you are prepared, test your skills using **TCS**, **Wipro**, **Amazon** and **Microsoft** Test Serieses.