Microsoft Interview Experience for SDE
Round 1: There was a codility round with 2 questions for 100mins, question level medium.
Round 2: Live coding on codility, 1 leetcode hard question was asked.
Question: https://leetcode.com/problems/recover-a-tree-from-preorder-traversal/
Round 3: Live coding on codility, 2 questions were asked medium-hard level.
- Question 1: Given an array of repressing gold coins at each position, for any position you can take half of the value at that index an infinite number of times. You have k chances, find the max gold coin you can collect.
Solution: Put all values in a priority queue and run till k times, collect half and push the remaining again in the priority queue.
- Question 2: Variation of https://www.w3wiki.net/iterative-letter-combinations-of-a-phone-number/
Round 4: LLD round, was asked to implement malloc() and free() functions for Linux.
Solution: I used DLL to represent the start and end index of a memory block. Once malloc() is called, I will parse the DLL and use best fit and return the startIndex of the memory address allocated, I also stored the size of the memory block allocated in a map so I could use it for free(). For free(), I would add the node back in DLL and apply merge intervals logic to merge adjacent blocks.
Was also asked about my current job role.
Round 5: LLD round, was asked to implement a rate limiter, to allow only 100 requests per second from a unique IP.
Along with this behavioral questions were asked like why Microsoft, why I am looking for a change, etc.
Contact Us