Microsoft | New Grad | Sunnyvale | Feb 2022
Status: New grad, MS CS Top 50 CS school
Position: New Grad at Microsoft
Location: Sunnyvale, CA
Date: February 20, 2022
Hello I recently gave an onsite interview at Microsoft (Sunnyvale office). The position was not for a specific team. I got selected for the interview through my college career fair. I wanted to share the onsite interview questions as the leetcode discussion section has helped me a lot to prepare for the interview.
In order to prepare for the interview I did the entire Microsoft explore section in LC and did trees and linked list questions extensively because I heard they were Frequently asked.
Onsite Interview: (4 Rounds)
The interviewer started by asking questions from my Resume and about my current work exp in depth and we spoke about the technologies they used.
I cannot find this question online and it was a weird question:
Given a cache array where the data is stored in bytes. You have an API call which will call 4k bytes and return a byte array, so every time You have an API call it will read the next 4k bytes every time. You have a function that looks like read(nbytes, buffer_array). Where nbytes are the number of bytes required to put in buffer_array which is a char array. So basically you need to get 4k bytes using the api call and store bytes to char array. For the next read call you need to use the remaining bytes from the first api call and then again do an api call if necessary.
You have 0 bytes so you can do an API call
read4k()=> You have 4k bytes, You use 1 byte to return in buffer_array. Remaining are 4k-1 bytes
You already have 4k-1 bytes remaining from the previous api call so use that.
Now you have 2k-1 bytes remaining.
You have 2k-1 bytes.
But you need to return 6k bytes. You do an API call. Still the total bytes you have are 2k-1+4k = 6k-1
You again do an API call. Which gives you 10k-1 bytes and then you can return 6k bytes in the buffer array.
I got really stuck in starting as I didn’t know that Python had a buffer_array and then I didn't know how to convert a byte array into a char array. Later on the interviewer said let's say we have a toCharArray(). After that it was a pretty straightforward solution.
Round 2 :-
The interviewer didn’t ask me anything based on my resume or work experience. He started shooting questions about distributed systems which I didn’t expect to be asked as I thought the new grad doesn't have system design questions. But as I have some work experience I had to come up with some answers.
I was asked to design an online ticketing system.
Later on to solve a 2-sum with O(1) space and implement merge sort.
I was asked to serialize and deserialize a binary tree.
He then asked me many questions regarding databases from my Resume.
Round 4 :-
He asked me to implement HashMap using the primitives of Java. He was really unprofessional and even though I gave the right solution in the first 5 minutes. He seemed dissatisfied, continuously looking at his phone and interrupting me to take phone calls. He left the room after 20 minutes telling me I am free to leave.
It was a weird match by Microsoft I guess as the team I was interviewing for was Azure networking team and I have no Networking experience whatsoever. Also all my interviewers were managers of sister teams and they didn’t have much coding knowledge and so they interviewed me on design and analysis skills rather than coding skills. I hope this helps others who are interviewing at Microsoft.