All Posts

1582 articles

dsa5 min read

Design Browser History — Stack-Based Navigation

Implement browser back/forward navigation using an array with a current index pointer. This O(1) design models the two-stack navigation pattern used in browser engines and undo/redo systems.

Read →
dsa5 min read

Design a Leaderboard — Score Tracking with Top K

Design a real-time leaderboard that tracks player scores, supports score additions, top-K sum queries, and resets. A pattern used in gaming platforms, competitive coding sites, and live event dashboards at Amazon and Riot Games.

Read →
dsa6 min read

Design Snake Game — Deque-Based State Machine

Simulate a snake game where the snake eats food to grow and dies if it hits walls or itself. Uses a deque for O(1) head insertion and tail removal, plus a HashSet for O(1) self-collision detection.

Read →
dsa7 min read

Design Skiplist — Probabilistic Sorted Structure

Implement a skip list from scratch with O(log n) expected search, add, and erase. The probabilistic sorted linked list used in Redis sorted sets and LevelDB—a must-know data structure for senior FAANG interviews.

Read →
dsa5 min read

Design Log Storage System — Timestamp Range Retrieval

Design a log storage system that retrieves log IDs within a timestamp range at a specified granularity. Uses prefix-based string comparison to truncate timestamps—a pattern used in log aggregation systems like Elasticsearch and CloudWatch.

Read →
Page 156 of 317