# MakeMyTrip Interview Experience | (On Campus 2019)

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