Microsoft visited Thapar Institute of Engineering and Technology for hiring. The first round was on cocubes. There were different sets and the questions that I had in my set were:-
- Given two numbers, ‘m’ and ‘n’, after adding m+n if the no of digits in m + n and n are same return n, otherwise, return m + n. (2 marks)
- Given a number in the form of a string, return the next smallest palindrome bigger than the given number. (3 marks)
- Given a number in the form of a string, remove k elements from it so that it forms the smallest number possible. (5 marks)
I did the first two efficiently and did the last question with brute force (checking all combinations and selecting the smallest one) as I was not able to come up with the efficient approach.
From about 200 students, 68 students were selected for group fly round.
Group Fly Round
2 questions were given to be solved in 2 hours. Both were pretty standard dynamic programming questions.
- Remove min no of elements such that the resulting sequence is in strictly increasing order.
- Word Break problem. Our problem was a slight variation of the problem in the link. We had to find if the string forms a meaningful sentence with fewest words possible.
28 students were selected for next round.
F2F Interview Round 1
I was interviewed by the senior most engineer from Microsoft. He greeted me and then became serious afterwards. He gave me the problem gas stations. First he asked whether I had solved it before, to which I said no, as I had not solved it before.
I gave him two approaches, the O(n^2) one where I would check every pump for a circular tour. Then he asked me to improve the solution to linear time, and I did it.
Then he gave me another problem, Alien Dictionary. I was discussing my approach but said me to move on as I was taking too much time. He then asked me if I had any questions for him. I asked him what he does on daily basis at Microsoft. He replied to my question happily. And asked me to wait.
I thought I will be rejected as I did not solve the second question completely, but by the grace of God, I was allowed to sit for further rounds.
F2F Interview Round 2
This round was good. The interviewer was very friendly and calm. He first introduced himself and asked my to give a quick introduction. Then he also asked me about my interests. Then he asked me a few questions.
- Given a function f1, which returns either 0 or 1, both with probability 50%. Make another function f2 such that the probability of returning 0 becomes 1/3 and returning 1 becomes 2/3.
- Given an array find all the pairs in the array where their absolute difference equals k.
- Given the arrival and departure times of guests in a hotel, find out the time interval where there will be max no of guests and the max no of guests. A similar problem.
This round went well, he asked if he had any questions for him, I asked him a few and replied them happily. I asked,
- How can I improve?
- What product are you working on?
F2F Interview Round 3
Again a friendly interviewer. He asked me to introduce myself and took a look at my resume. He asked me to describe one of my projects. I described my project. He asked how I implemented a certain feature, and I gave him the answer.
Then he asked me few questions of which few I had done before, so I told him that I had done that questions before.
- Given two strings A and B. Count the no of anagrams of smaller string in the larger string.
- Given a rotated sorted array, search for a given element.
He asked me what were the other subjects I liked from computer science. I replied OS, but he did not ask any questions on OS.
This interview went well too. He asked me if I had any questions for him and I again asked the same questions that I asked in the previous round.
I was asked to wait outside. Then the HR told me that there are no further rounds for me and I can leave for the hostel. The result came the next morning and I was selected as a Software Engineer. I got a feeling which I had never experienced before. All the hard work paid off finally. The entire process took more than 12 hours.
Total 5 students were selected for full-time role and 5 students were selected for the internship.
Number 1 tip: Be confident and discuss all approaches before discussing the most optimal approach.
Number 2 tip: Keep talking, interviewers will give hints if you go wrong.
I would like to thank geeksforgeeks as it was a crucial resource during my preparation.
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.