Microsoft | ONCAMPUS
Round 1 (Coding Round):
In this round, 3 coding questions were to be solved within a period of 90 minutes. It was held on the Mettl platform. This round was quite easy and I had completed it within 20 minutes.
Given an integer, find the total number of set bits, first and the last set bit.
Given a string, find out the longest palindromic subsequence.
Given an array of integers, find the number of inversions in the array. The expected time complexity is O(n2).
After the coding round, there were 3 rounds of interviews.
Round 2 (Technical Interview):
This round went about for nearly 50 minutes and it was quite smooth. The first question asked by the interviewer was based on my projects, experiences, and my current work in the ongoing internships. After this, one coding question based on a binary search was asked.
Given a sorted array pivoted (rotated by some number) at some point, find the position of a given element.
I gave a brute force O(n) approach straight away and made it clear that I was thinking of an optimized solution. Later, I explained the O(log n) solution using binary search and was asked to write the code for the same. He found something peculiar in my code and I had to prove myself through a test case. Cross questioning on the written code was followed by a question to dry run the code on test cases where my code might fail. I suggested a test case and it failed. Finally, I made the corrections and the interviewer was quite satisfied. This round went pretty well.
Round 3 (Technical Interview):
This round went for nearly 1 hour and 20 minutes. It wasn’t as smooth as the previous 2 rounds and I guess most of the filtering of candidates took place in this round. I was tested on my analytical, coding, and problem-solving skills in this round.
Why was I interested in machine learning and deep learning (which is my area of interest) and not my core branch subjects?
Then, 3 output questions were asked, one of them was based on pointers, another was based on recursion and storage classes. I don’t remember the 3rd one.
The next set of questions were based on LRU cache. Define the LRU cache and what data structure would you use to implement it? My first approach was using queue but later on, I felt vectorized implementation along with hashing would work. I was questioned about its space and time complexity and was also asked to further optimize the space complexity. I gave a solution with optimized space complexity at the cost of time complexity. He seemed satisfied with the solutions. Then, I was asked about a real-life example of LRU cache. I couldn’t think of an example at that time.
Questions based on locked transactions in the banking sector. What will happen if 2 transactions are being made from the same account exactly at the same time? What are the different checks made by the bank to keep a check on frauds? I suggested some methods based on analytical thinking and observations from my daily life.
How is a URL shortened?
Given an array of integers what will be the maximum OR value? Find the smallest subset that gives the maximum OR value. I solved this using dynamic programming.
Given a BST, find the distance between 2 nodes whose values are given. I explained the DFS approach for this by taking one element as the root.
Round 4(Technical + HR Interview):
This round lasted for about 45 minutes. Questions in this round were based on the following topics:
Data Structures and Algorithms
Machine Learning and Deep Learning
My advice to all the candidates who are going to appear for an interview in the coming weeks or months is to stay calm and confident during the entire process. You can deliver your best only when you are calm and composed. According to me, the companies not only test you on your technical knowledge but also on how you interact during the interview and handle difficult situations. Students generally focus on OOPs, DS/Algo, but I think preparing on topics like Operating Systems, Networking, and System Design will be really helpful in the interview process.
The master tip to each and every aspirant is to keep interacting with the interviewer, think aloud so that the interviewer gets to know your approach.