System Design: Flash Sale — High-Concurrency Inventory, Queue-Based Purchase, and Oversell Prevention
6 min read The Flash Sale Problem A flash sale offers a limited quantity of items at a steep discount for a short […] Read article
6 min read The Flash Sale Problem A flash sale offers a limited quantity of items at a steep discount for a short […] Read article
7 min read Core Entities Workspace: workspace_id, name, owner_id, plan (FREE, PRO, ENTERPRISE), created_at. Board: board_id, workspace_id, name, description, visibility (PUBLIC, PRIVATE, WORKSPACE), Read article
6 min read Why String Hashing? Naive string matching (check every position in the text for the pattern) is O(n*m) where n = Read article
7 min read Core Requirements An inventory management system tracks the quantity of products across one or more warehouses, coordinates stock reservations during Read article
7 min read Core Entities Auction: auction_id, seller_id, item_id, title, description, start_price, reserve_price (nullable, minimum price to sell), buy_now_price (nullable, instant purchase), start_time, Read article
6 min read BFS Fundamentals BFS (Breadth-First Search) explores a graph level by level, visiting all nodes at distance 1 before distance 2, Read article
7 min read Core Requirements A digital wallet holds a user’s balance and enables peer-to-peer transfers. Key operations: add money (top-up from a Read article
7 min read Core Entities Course: course_id, title, description, instructor_id, category, level (BEGINNER, INTERMEDIATE, ADVANCED), language, price, published_at, status (DRAFT, PUBLISHED, ARCHIVED), total_enrolled. Read article
6 min read When Math Problems Appear Math interview problems test number theory, combinatorics, and modular arithmetic. Common patterns: prime checking and sieve, Read article
7 min read Why Resilience Patterns? In a microservices architecture, service A calls service B which calls service C. If C is slow Read article
7 min read Core Entities Restaurant: restaurant_id, name, address, lat, lng, cuisine_type, rating, is_open, prep_time_minutes (average). MenuItem: item_id, restaurant_id, name, description, price, category, Read article
6 min read Choosing the Right Algorithm Unweighted graph (or all weights equal): BFS gives the shortest path in O(V+E). Weighted graph, non-negative Read article
7 min read Overview An ad server matches advertisers’ ads to available ad slots on publisher pages in real time. The two main Read article
6 min read Core Entities Hotel: hotel_id, name, address, city, star_rating, amenities (JSON), check_in_time, check_out_time. RoomType: room_type_id, hotel_id, name (STANDARD, DELUXE, SUITE), max_occupancy, Read article
5 min read Core Interval Pattern Interval problems involve ranges [start, end] and typically ask: merge overlapping intervals, find gaps, count the minimum Read article