Category: Interval-based system design problem# Top 5 Recently Asked System Design Questions - Microsoft These are the commonly asked system design questions from Microsoft interviews and some...Input: List Output: Computed result
codingMediumVerified Question#2
2. Design Rate Limiter
Category: Sliding window coding problem# Design Rate Limiter Design a rate limiter system that controls the number of requests allowed within a specified time window. The rate limiter is...Input: String Output: Computed result
Category: Trie-based coding problemInput: String Output: Computed result
codingMediumVerified Question#4
4. Object Oriented Design - Notification Service
Category: Trie-based coding problem# Problem Statement Design a notification service that supports sending notifications through multiple channels (SMS, Email) and is architected to...Input: Number(s) Output: Computed result
codingMediumVerified Question#5
5. Shortest Substring with N Unique Characters
Category: String coding problem# Shortest Substring with N Unique Characters *This is a variation of the leetcode problem* Given a string s and an integer n, find the length of...Input: String Output: Computed result
codingHardVerified Question#6
6. Rate Limiter
Category: Sliding window coding problemDesign a rate limiter that tracks API requests per client and enforces limits using a sliding time window. Your system must support: - hit(key,...Input: Given input Output:** Computed result
codingHardVerified Question#7
7. Non-Adjacent Team Selection
Category: Tree coding problem# Question You are given n people labeled from 0 to n - 1. Some pairs of people know each other directly. These relationships are given as a...Input: List Output: Computed result
codingMediumVerified Question#8
8. Bounded Repeat Substring
Category: String coding problemA sensor data stream is represented as a string of characters. A contiguous segment of the stream is considered valid if it contains no three...Input: String Output: Computed result
codingMediumVerified Question#9
9. OA [CodeSignal] Prime Jumps
Category: Algorithm coding problem# OA [CodeSignal] Prime Jumps A game is played with the following rules: - A player starts at cell 0 with a score of 0. - There is a row of n cells...Input: Number(s) Output: Computed result
codingHardVerified Question#10
10. Combine N-ary Trees
Category: Tree coding problemYou are given the roots of two N-ary organization charts, each representing a hierarchical department structure. Every node has an integer...Input: List Output: Computed result
codingMediumVerified Question#11
11. Digit Replacement Maximizer
Category: String coding problemA numeric optimization system performs exactly k substitution operations on a number string s. In each operation, choose any digit in s that is...Input: String Output: Computed result
codingMediumVerified Question#12
12. Best Window For Target Count
Category: Trie-based coding problemA log analysis tool searches for the most frequent occurrence of a specific error code within a fixed-size window of log entries. Given an integer...Input: Array Output: Integer
codingMediumVerified Question#13
13. Evens Before Odds
Category: Array coding problemYou are given an integer array nums. Rearrange nums so that all even numbers appear before all odd numbers. The relative order of even or odd...Input: Array Output: Integer
system designSeniormessaging#1
1. [OA] Message Queue Client — design a messaging system for asynchronous processing in Microsoft Azure.
In Microsoft Azure, effective message queuing is essential for reliable asynchronous communication between microservices. Problem: Implement a MessageQueue class with the following methods: - sendMessage(queueName: String, message: String) -> void: Adds a message to the specified queue. - receiveMessage(queueName: String) -> String: Retrieves a message from the specified queue; returns an empty string if the queue is empty. - peekMessage(queueName: String) -> String: Returns the next message in the queue without removing it.Example 1: Input: MessageQueue mq = new MessageQueue(); mq.sendMessage("queue1", "message1"); mq.sendMessage("queue1", "message2"); mq.receiveMessage("queue1"); Output: "message1" mq.peekMessage("queue1"); Output: "message2"Constraints: - Queue names and messages are at most 100 characters long.
system designSeniorapi design#2
2. [OA] RateLimiter — control API request rates effectively for Microsoft Azure APIs.
In Microsoft Azure, managing API request rates is crucial to ensure the infrastructure can handle incoming traffic while providing a stable service. Problem: Implement a RateLimiter class with the following methods: - allowRequest(userId: String) -> boolean: Returns true if the request from the user is allowed, false otherwise. - updateLimits(userId: String, limit: int) -> void: Updates the request limit for the user.Example 1: Input: RateLimiter rateLimiter = new RateLimiter(); rateLimiter.updateLimits("user1", 5); rateLimiter.allowRequest("user1"); Output: true rateLimiter.allowRequest("user1"); Output: true rateLimiter.allowRequest("user1"); Output: true rateLimiter.allowRequest("user1"); Output: true rateLimiter.allowRequest("user1"); Output: true rateLimiter.allowRequest("user1"); Output: falseConstraints: - A user can make up to 10^3 requests per second. - UserId string is at most 100 characters long.
codingHarddynamic programming#3
3. [OA] Dynamic Programming — calculate optimal pricing for Microsoft subscription services.
Within Microsoft's subscription services, pricing models often require optimal strategies to maximize revenue while considering customer retention. Problem: You have a list of prices, where prices[i] is the price of a subscription option for the ith month. Write a function maxProfit(prices: List[int], k: int) -> int that returns the maximum profit achievable by buying and selling at most k times. A transaction is when you buy and sell a subscription.- Method:maxProfit(prices: List[int], k: int) -> int Description: Returns the maximum profit from at most k price transactions.Example 1: Input: prices = [1, 2, 3, 0, 2], k = 2 Output: 3 Explanation: Buy on month 1 and sell on month 3, then buy on month 4 and sell again for a total profit of 3.Example 2: Input: prices = [1, 2], k = 1 Output: 1 Explanation: Only one transaction possible.Constraints: - 1 <= prices.length <= 1000 - 1 <= k <= 100
codingHardgraph#4
4. [OA] Dijkstra's Algorithm — find the shortest path for Microsoft's Azure resource deployment.
In Microsoft's Azure services, resource allocation and deployment often include determining the shortest paths for data transfer between different data centers. Problem: Given a weighted directed graph represented by an adjacency list, where each node represents a data center and each edge represents the time to transfer data, implement a function that finds the shortestPath(source: int, destination: int) -> List[int] that returns the shortest path from source to destination. If no path exists, return an empty list.- Method:shortestPath(source: int, destination: int) -> List[int] Description: Returns the path with the minimum transfer time from source to destination.Example 1: Input: source = 0, destination = 4, graph = [[(1, 1), (2, 4)], [(2, 2), (3, 7)], [(3, 3)], [(4, 1)], []] Output: [0, 1, 2, 3, 4] Explanation: The shortest path is from data center 0 to 1 to 2 to 3 to 4 with a total cost of 7.Example 2: Input: source = 0, destination = 3, graph = [[(1, 1), (2, 4)], [(3, 2)], [(3, 5)], []] Output: [] Explanation: There’s no path from 0 to 3.Constraints: - 1 <= graph.length <= 100 - 0 <= graph[i][j][0] < graph.length - 1 <= graph[i][j][1] <= 10^4 - No duplicate edges.