Two Sum
The hash table trick that makes O(n²) become O(n) and why this pattern appears everywhere from feature stores to embedding lookups.
A comprehensive collection of data structures and algorithms problems, from fundamentals to advanced topics. Each problem explores multiple solutions, complexity analysis, and real-world applications.
Each problem includes:
Arrays & Hash Tables:
Stacks:
Linked Lists:
Design:
Dynamic Programming:
Trees & Graphs:
Sorting & Searching:
String Manipulation:
Below you’ll find all DSA problems in chronological order:
Content created with the assistance of large language models and reviewed for technical accuracy.
The hash table trick that makes O(n²) become O(n) and why this pattern appears everywhere from feature stores to embedding lookups.
Why a simple stack solves bracket matching, expression parsing, and even neural network depth management in one elegant pattern.
The pointer manipulation pattern that powers merge sort, data pipeline merging, and multi-source stream processing.
The single-pass pattern that powers streaming analytics, online algorithms, and real-time decision making in production systems.
Master the pattern behind online algorithms, streaming analytics, and dynamic programming, a single elegant idea powering countless production systems.
The Fibonacci problem in disguise, teaching the fundamental transition from recursion to dynamic programming to space optimization.
Master the fundamental patterns of tree traversal: the gateway to solving hundreds of tree problems in interviews.
Master BST validation to understand data integrity in tree structures, critical for indexing and search systems.
Master binary search to understand logarithmic algorithms and efficient searching, foundational for optimization and search systems.
Master linked list manipulation through reversal - a fundamental pattern for understanding pointer logic and in-place algorithms.
Master LRU cache design: O(1) get/put with hash map + doubly linked list. Critical for interviews and production caching systems.
Master digit-by-digit addition with linked lists: Handle carry propagation elegantly. Classic problem teaching pointer manipulation and edge cases.
Master the two-pointer greedy technique that powers resource optimization in production ML systems.
Master backtracking to generate all valid combinations—the foundation of ensemble model selection and multi-model systems.