design
design is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.
Interview Signal
Frequently tests problem modeling, edge handling, and verbal clarity.
Common Pitfall
Template-only answers break under follow-up questioning.
Practice Strategy
Practice in 3-5 problem rounds and always review complexity alternatives.
Recommended Progression
LRU Cache
Implement an efficient LRU Cache using hash table and doubly-linked list to achieve O(1) operations for get and put.
Min Stack
Design a stack with O(1) operations to push, pop, retrieve the top element, and get the minimum element in constant time…
Binary Search Tree Iterator
Implement an iterator for in-order traversal of a binary search tree (BST), maintaining traversal state with stack-based…
Implement Trie (Prefix Tree)
This problem requires designing a Trie (Prefix Tree) to efficiently store and query strings using hash table concepts fo…
Design Add and Search Words Data Structure
Build a WordDictionary supporting dynamic word addition and search with wildcard matching efficiently using Trie and DFS…
Implement Stack using Queues
This problem tests your ability to simulate a LIFO stack using two queues while preserving all standard stack operations…
Implement Queue using Stacks
Implement a queue using two stacks, focusing on stack-based state management to achieve FIFO behavior in a queue.
Peeking Iterator
Design an iterator with peek functionality, adding to the standard next and hasNext operations for efficient element acc…
Find Median from Data Stream
Implement a MedianFinder class that supports adding numbers and finding the median from a data stream.
Serialize and Deserialize Binary Tree
This problem asks to serialize and deserialize a binary tree, requiring an efficient approach to handle traversal and st…
Range Sum Query - Immutable
The Range Sum Query - Immutable problem involves implementing a data structure to handle range sum queries efficiently.
Range Sum Query 2D - Immutable
Design a 2D matrix class that efficiently handles sum queries with O(1) time complexity using a prefix sum approach.
Range Sum Query - Mutable
Implement a mutable range sum query using efficient design patterns to handle multiple updates and range sum queries.
Flatten Nested List Iterator
Implement an iterator to flatten a nested list of integers, accounting for potential nesting levels.
Data Stream as Disjoint Intervals
The problem involves designing a class to summarize a data stream of non-negative integers as disjoint intervals using b…
Design Twitter
Design Twitter requires implementing post, follow, unfollow, and news feed retrieval using linked-list pointer manipulat…
Insert Delete GetRandom O(1)
Implement a data structure supporting insert, delete, and getRandom in average O(1) using array plus hash mapping.
Insert Delete GetRandom O(1) - Duplicates allowed
This problem challenges you to design a data structure that supports insertion, removal, and random access with O(1) tim…
Shuffle an Array
Shuffle an Array requires designing a class to randomly permute an integer array while ensuring all permutations are equ…
All O`one Data Structure
Implement a data structure that tracks string counts and retrieves max or min keys efficiently in constant time.
Serialize and Deserialize BST
Design an algorithm to serialize and deserialize a binary search tree with efficient traversal and state tracking.
LFU Cache
Implement an LFU Cache using linked-list pointer manipulation with constant-time get and put operations for interview sc…
Encode and Decode TinyURL
Design a class that encodes and decodes URLs using a URL shortening approach based on hash tables and strings.
Design Circular Queue
Design a circular queue that allows efficient FIFO operations using linked-list pointer manipulation to optimize space u…
Design Circular Deque
Design and implement a circular deque using linked-list pointer manipulation, ensuring efficient insertion and deletion …
Implement Magic Dictionary
Design a Magic Dictionary to allow searching with one-character modifications, using Hash Table and String techniques.
Map Sum Pairs
Design and implement a data structure that supports efficient insertion and sum queries based on string prefixes.
Kth Largest Element in a Stream
Find the kth largest element in a dynamic stream using binary-tree traversal and efficient state tracking with a min-hea…
Design HashSet
Implement a custom HashSet without built-in libraries using array scanning and hash lookup for efficient membership chec…
Design HashMap
Implement a custom HashMap from scratch using array scanning and hash lookup without built-in libraries for efficient ke…
Design Linked List
Implement a custom linked list supporting head, tail, index insertions, retrieval, and deletions efficiently with pointe…
Range Module
Design a RangeModule to track and query half-open intervals using segment trees or ordered sets.
My Calendar I
Implement a calendar supporting non-overlapping event bookings using binary search for efficient insertion and conflict …
My Calendar II
Implement a calendar that allows double bookings but prevents triple bookings, managing overlapping intervals efficientl…
My Calendar III
Implement My Calendar III to track maximum overlapping events efficiently using binary search and segment tree technique…
Prefix and Suffix Search
Design a dictionary to search words by both prefix and suffix using a Trie structure and hash lookups.
Exam Room
Simulate an exam room where each student chooses a seat maximizing distance to others, using design plus heap structures…
Maximum Frequency Stack
Design a stack-like data structure to manage elements and handle frequent stack operations, including popping the most f…
RLE Iterator
Design an efficient iterator for a run-length encoded array, handling large counts and sequential access correctly every…
Online Stock Span
Design an efficient algorithm using stacks to calculate the stock span for daily price quotes.
Online Election
Solve the Online Election problem by implementing a class that tracks votes and queries the leading candidate at any giv…
Complete Binary Tree Inserter
Implement a data structure to insert nodes into a complete binary tree while preserving its completeness efficiently.
Number of Recent Calls
The "Number of Recent Calls" problem involves designing a class to efficiently track recent requests within a time windo…
Time Based Key-Value Store
Implement a time-based key-value store that retrieves the latest value at a given timestamp using efficient binary searc…
Stream of Characters
Implement a StreamChecker that detects if any suffix of a character stream matches a given list of words using efficient…
Snapshot Array
Implement a SnapshotArray that efficiently tracks element changes and retrieves past states using array scanning and has…
Online Majority Element In Subarray
Efficiently find the majority element in any subarray using a data structure optimized for multiple range queries.
Dinner Plate Stacks
Design a system that manages dinner plate stacks using stack-based state management, handling dynamic plate placement an…
Design Skiplist
Implement a Skiplist efficiently using linked-list pointer manipulation to support search, add, and erase operations in …
Find Elements in a Contaminated Binary Tree
Recover values in a contaminated binary tree and efficiently check for existence using traversal and state tracking tech…
Iterator for Combination
Implement an iterator that generates all combinations of a given length using efficient backtracking with pruning.
Tweet Counts Per Frequency
Design an efficient solution to track and retrieve tweet counts over different frequencies using binary search and hash …
Product of the Last K Numbers
Design a data structure to efficiently return the product of the last k numbers in a dynamic integer stream using prefix…
Apply Discount Every n Orders
Compute customer bills with periodic discounts efficiently using array scanning and hash mapping for fast product price …
Design a Stack With Increment Operation
Implement a stack that supports push, pop, and targeted increment operations efficiently using array-based state managem…
Design Underground System
Design an underground system to calculate travel times between stations using hash tables for efficient lookups and aver…
Design Browser History
Implement a browser history tracker with back, forward, and visit operations using linked-list pointer manipulation effi…
Subrectangle Queries
Implement the SubrectangleQueries class to handle dynamic updates and value queries on a 2D rectangle.
Kth Ancestor of a Tree Node
Find the kth ancestor of any node in a tree using efficient binary-tree traversal and dynamic state tracking methods.
Throne Inheritance
Throne Inheritance requires modeling a dynamic family tree with births and deaths to determine the kingdom's inheritance…
Design Parking System
Implement a class to manage a parking lot with fixed slots for big, medium, and small cars, tracking occupancy efficient…
Fancy Sequence
Implement a Fancy sequence supporting append, addAll, and multAll operations efficiently using cumulative math design te…
Design an Ordered Stream
Design an Ordered Stream that returns values in increasing order based on unique integer IDs with efficient insertion an…
Design Front Middle Back Queue
Implement a queue that efficiently handles push and pop operations at the front, middle, and back using pointer manipula…
Design Authentication Manager
Implement an AuthenticationManager using linked-list pointer manipulation and a hash map to track token expirations effi…
Finding MK Average
Find the MKAverage of a stream of integers using a queue-driven approach with efficient state management.
Seat Reservation Manager
Manage seat reservations efficiently using a design combining priority queue to always return the lowest available seat …
Finding Pairs With a Certain Sum
Efficiently track and count pairs across two arrays using array scanning plus hash lookup to support dynamic updates.
Design Movie Rental System
Implement a movie rental system with efficient search, rent, drop, and report operations using arrays and hash lookups.
Operations on Tree
Design a tree data structure that allows locking, unlocking, and upgrading nodes with user-specific actions.
Detect Squares
Detect Squares requires tracking points on a 2D plane to quickly count all possible axis-aligned squares using efficient…
Stock Price Fluctuation
Design an efficient algorithm for managing stock price fluctuations with incorrect and unordered data in a data stream.
Simple Bank System
Design a simple bank system that processes transactions like withdrawals, deposits, and transfers while managing account…
Walking Robot Simulation II
The Walking Robot Simulation II problem challenges you to simulate robot movements and track its position and direction …
Range Frequency Queries
Design a data structure to handle efficient frequency queries for subarrays, focusing on hash-based lookups and efficien…
Sequentially Ordinal Rank Tracker
Track rankings of locations with names and scores, adding new locations and retrieving top-ranked ones efficiently.
Design Bitset
Master the Design Bitset problem by efficiently managing bit flips, counts, and indexed updates with array and hash look…
Encrypt and Decrypt Strings
The 'Encrypt and Decrypt Strings' problem involves creating a data structure that can encrypt and decrypt strings using …
Design an ATM Machine
Design an ATM machine that stores and withdraws money with given denominations and prioritizes larger values during with…
Count Integers in Intervals
Design and implement a data structure to efficiently add intervals and count the total number of integers covered by the…
Booking Concert Tickets in Groups
Design a ticketing system to allocate concert seats in specific groupings while efficiently handling seat reservations.
Design a Text Editor
Design a text editor that supports text manipulation and cursor navigation operations efficiently with linked-list-based…
Smallest Number in Infinite Set
Design a data structure to handle the smallest missing element in an infinite set, with the ability to add and remove el…
Design a Number Container System
Learn to implement a Number Container System using hash tables and design techniques to efficiently track numbers and in…
Design a Food Rating System
Design a food rating system that tracks and updates ratings of foods, finding the highest rated items by cuisine.
Longest Uploaded Prefix
Calculate the longest continuous uploaded prefix in a video stream efficiently using a mix of binary search and data str…
Design Memory Allocator
Design a memory allocator that simulates allocation and deallocation of memory blocks.
Find Consecutive Integers from a Data Stream
Design a data stream checker to identify consecutive integers from a stream, focusing on handling state transitions effi…
Design Graph With Shortest Path Calculator
Implement a dynamic weighted directed graph with efficient shortest path queries and edge additions in real time.
Frequency Tracker
Design a data structure to track values and answer frequency-related queries efficiently using hash tables.
Design Neighbor Sum Service
Design a service that computes sums for adjacent and diagonal elements in a 2D grid.
Design Task Manager
Design a Task Manager that can efficiently handle task management operations such as adding, editing, executing, and rem…
Design Spreadsheet
Design a spreadsheet that supports setting, retrieving, and resetting values, with the ability to handle formulas refere…
Implement Router
Efficiently design a Router class to manage network packets with memory limits using array scanning and hash lookups.
Related Patterns
Array scanning plus hash lookup
22 linked problems
Linked-list pointer manipulation
12 linked problems
Binary-tree traversal and state tracking
9 linked problems
Binary search over the valid answer space
9 linked problems
Design plus Heap (Priority Queue)
9 linked problems
Stack-based state management
7 linked problems