Microsoft SWE 2 Onsite Interview Experience and Questions
Question Details
Microsoft Hiring Drive (October 31st)
**
Round 1 Coding** Two Data Structures and Algorithms questions were asked: 1.
Max Consecutive Ones III: Find the maximum number of consecutive 1s in a b
Full Details
Microsoft Hiring Drive (October 31st)
**
Round 1 Coding** Two Data Structures and Algorithms questions were asked: 1.
Max Consecutive Ones III: Find the maximum number of consecutive 1s in a binary array if you can flip at most K 0s. 2.
Rotting Oranges: Determine the minimum time required to rot all fresh oranges in a grid, given that rotten oranges affect adjacent fresh ones every minute.
**
Round 2 Coding**
Problem: Word Ladder.
Variation: In addition to finding the length of the shortest transformation sequence, the solution required printing one of the specific shortest sequences.
**
Round 3 High-Level Design (HLD)**
Problem Statement: Design a feature for a music streaming service (similar to Spotify) to return the Top K songs played in the last 7 days. The interviewer specifically requested to include only components relevant to this feature.
Proposed Solution: *
Logic: Implemented a sliding window approach covering a 7-day period. * Store (song : count) data for each specific day. * As the window slides, add data for the new day and remove data from the day exiting the window. * Aggregate the data from the current window and process it using a Min-Heap of size K to identify the top songs. * This calculation is performed daily. *
Architecture Components: *
Infrastructure: API Gateway and Load Balancer. *
Services: Playback Server and a dedicated TopK Song Server. *
Storage: Database for song metadata and a Cache to store the play counts. *
Concurrency: Proposed using Redis Redlock to handle concurrent data updates.
Result:
Rejected following the HLD round.
About This Question
This is a reported interview question from a microsoft interview for a swe role during the onsite round reported in 2025.
It covers the following topics: Arrays, Heap, Matrix, Os, Sliding Window, Sql, System Design, Two Pointers .