DSA + Competitive Programming
Master Problem Set
From 1600 to Expert — Your 3-Month Blueprint
■ Topics Covered ■ Total Problems ■ Timeline ■ Target
20 Chapters 500+ Problems 3–4 Months CF Expert / LC 2000+
LC = LeetCode | CF = Codeforces | Diff: Easy / Med / Hard / Varies | Problems marked ★ are must-solve classics
Table of Contents
01. ■ Arrays & Strings 35 problems
02. ↔■ Two Pointers & Sliding Window 18 problems
03. ■ Binary Search 20 problems
04. ■ Sorting & Greedy 17 problems
05. #■■ Hashing & Hash Maps 14 problems
06. ■ Linked Lists 16 problems
07. ■ Stacks, Queues & Monotonic Structures 16 problems
08. ■ Recursion & Backtracking 20 problems
09. ■ Trees 53 problems
10. ■■ Graphs 54 problems
11. ■ Dynamic Programming 60 problems
12. ■ Greedy Algorithms (Advanced) 12 problems
13. ■■ Heaps & Priority Queues 15 problems
14. ■ Tries (Prefix Trees) 12 problems
15. ■■ Segment Trees & Binary Indexed Trees (BIT/Fenwick) 14 problems
16. ■ Math & Number Theory 20 problems
17. ■■ Bit Manipulation 13 problems
18. ■ Advanced String Algorithms 16 problems
19. ■ Disjoint Set Union (DSU) & Advanced 16 problems
20. ■ CP Meta — Contest Strategy & Advanced Topics 22 problems
CHAPTER 01
■ Arrays & Strings
Foundation of all DS. Master prefix sums, in-place ops, and string manipulation.
■ Core Techniques
# Problem Name Platform Diff Key Concept / Algorithm
1 Two Sum LC Easy Hash Map, complement lookup
2 Best Time to Buy and Sell Stock LC Easy Single pass, min tracking
3 Contains Duplicate LC Easy Hash Set
4 Product of Array Except Self LC Med Prefix & suffix products
5 Maximum Subarray (Kadane's) LC Med DP / Greedy
6 Maximum Product Subarray LC Med Track min & max
7 Find Minimum in Rotated Sorted Array LC Med Modified Binary Search
8 Search in Rotated Sorted Array LC Med Binary Search with pivot
9 3Sum LC Med Sort + Two Pointers
10 Container With Most Water LC Med Two Pointers
■ Prefix Sum & Range Queries
# Problem Name Platform Diff Key Concept / Algorithm
11 Range Sum Query - Immutable LC Easy Prefix sum array
12 Subarray Sum Equals K LC Med Prefix sum + hash map
13 Count of Range Sum LC Hard Merge sort / BIT
Maximum Sum of Two Non-Overlapping
14 LC Med Sliding prefix
Subarrays
15 Minimum Size Subarray Sum LC Med Sliding window
■ String Manipulation
# Problem Name Platform Diff Key Concept / Algorithm
16 Valid Anagram LC Easy Frequency count
17 Group Anagrams LC Med Sorted key hashing
Longest Substring Without Repeating
18 LC Med Sliding window + set
Characters
19 Minimum Window Substring LC Hard Sliding window + map
20 Longest Repeating Character Replacement LC Med Sliding window
21 Palindromic Substrings LC Med Expand around center
22 Longest Palindromic Substring LC Med Manacher's / Expand
# Problem Name Platform Diff Key Concept / Algorithm
23 Encode and Decode Strings LC Med Delimiter encoding
24 Valid Palindrome II LC Easy Greedy skip
25 Reverse Words in a String LC Med Two-pass / deque
■ In-Place & Misc
# Problem Name Platform Diff Key Concept / Algorithm
26 Rotate Array LC Med Reverse trick
27 Set Matrix Zeroes LC Med In-place marking
28 Spiral Matrix LC Med Boundary simulation
29 Jump Game II LC Med Greedy BFS
30 Merge Intervals LC Med Sort + merge
31 Insert Interval LC Med Sweep line
32 Non-overlapping Intervals LC Med Greedy interval scheduling
33 Sort Colors (Dutch Flag) LC Med 3-way partition
34 Next Permutation LC Med Suffix scan + swap
35 Trapping Rain Water LC Hard Two pointers / stack
CHAPTER 02
↔■ Two Pointers & Sliding Window
Reduce O(n²) brute force to O(n). Essential for array/string interview patterns.
■ Two Pointers
# Problem Name Platform Diff Key Concept / Algorithm
1 Valid Palindrome LC Easy Left-right scan
2 Two Sum II - Sorted Array LC Med Opposite ends
3 4Sum LC Med Sort + 2-pointer outer loop
4 Remove Duplicates from Sorted Array LC Easy Slow-fast pointer
5 Move Zeroes LC Easy Partition pointer
6 Squares of Sorted Array LC Easy Opposite ends merge
7 Boats to Save People LC Med Greedy two-pointer
8 Bag of Tokens LC Med Two-pointer greedy
■ Sliding Window
# Problem Name Platform Diff Key Concept / Algorithm
9 Maximum Average Subarray I LC Easy Fixed window
Longest Subarray of 1s After Deleting One
10 LC Med Variable window
Element
11 Fruit Into Baskets LC Med At-most-K distinct
12 Substrings with All Three Characters LC Med Shrink window
13 Max Consecutive Ones III LC Med Flip k zeros
14 Permutation in String LC Med Fixed window + freq
15 Find All Anagrams in a String LC Med Sliding freq map
16 Sliding Window Maximum LC Hard Monotonic deque
Number of Substrings Containing All Three
17 LC Med Shrink window
Characters
18 K Radius Subarray Averages LC Med Fixed window
CHAPTER 03
■ Binary Search
Beyond sorted arrays — search the answer space. Codeforces loves binary search on monotone functions.
■ Classic
# Problem Name Platform Diff Key Concept / Algorithm
1 Binary Search LC Easy Standard template
2 Search Insert Position LC Easy Lower bound
3 First Bad Version LC Easy Predicate binary search
4 Find Peak Element LC Med Half elimination
5 Search a 2D Matrix LC Med Flatten index
6 Search a 2D Matrix II LC Med Staircase search
7 Median of Two Sorted Arrays LC Hard Binary search on partition
8 Find Minimum in Rotated Sorted Array II LC Hard Handle duplicates
■ Binary Search on Answer
# Problem Name Platform Diff Key Concept / Algorithm
9 Koko Eating Bananas LC Med Search speed
Minimum Number of Days to Make m
10 LC Med Check feasibility
Bouquets
11 Aggressive Cows CF Med Classic BSOA
12 Split Array Largest Sum LC Hard Minimize maximum
13 Capacity To Ship Packages Within D Days LC Med Search capacity
14 Find the Smallest Divisor LC Med Search divisor
15 Path With Minimum Effort LC Med Binary search + BFS/UF
16 Magnetic Force Between Two Balls LC Med BSOA maximize min
17 Maximum Candies Allocated to K Children LC Med Search allocation
18 Cutting Ribbons LC Med Search cut length
19 Painter's Partition Problem CF Med Minimize max painter work
20 FFFFFFFFFFFFFFFF (Floor div trick) CF Varies Number theory + BS
CHAPTER 04
■ Sorting & Greedy
Many CP problems reduce to choosing a locally optimal strategy that yields global optimum.
■ Sorting Applications
# Problem Name Platform Diff Key Concept / Algorithm
1 Sort Colors LC Med 3-way Dutch flag
2 Wiggle Sort II LC Hard Virtual indexing
3 Maximum Gap LC Hard Pigeonhole / radix
4 Meeting Rooms II LC Med Sort + min-heap
5 Minimum Platforms CF Med Sort arrivals/departures
6 Count of Smaller Numbers After Self LC Hard Merge sort / BIT
7 Reverse Pairs LC Hard Merge sort count
■ Greedy Algorithms
# Problem Name Platform Diff Key Concept / Algorithm
8 Jump Game LC Med Track max reachable
9 Gas Station LC Med Total surplus check
10 Candy LC Hard Two-pass greedy
11 Task Scheduler LC Med Frequency + idle slots
12 Partition Labels LC Med Last occurrence greedy
Minimum Number of Arrows to Burst
13 LC Med Interval greedy
Balloons
14 Queue Reconstruction by Height LC Med Sort + insert
15 Assign Cookies LC Easy Sort + match
16 Earliest Finish Time (Activity Selection) CF Easy Classic greedy
17 Huffman Encoding CF Med Min-heap greedy
CHAPTER 05
#■■ Hashing & Hash Maps
O(1) lookup backbone. Know when to use set vs map vs multimap.
■ Problems
# Problem Name Platform Diff Key Concept / Algorithm
1 Two Sum LC Easy Classic hash map
2 LRU Cache LC Med HashMap + DLL
3 LFU Cache LC Hard Double map + DLL
4 Longest Consecutive Sequence LC Med Hash set O(n)
5 Top K Frequent Elements LC Med Bucket sort / heap
6 First Missing Positive LC Hard Index as hash
7 Isomorphic Strings LC Easy Bidirectional map
8 Word Pattern LC Easy Bijection check
9 4Sum II LC Med Split pairs hash
10 Subarrays with K Different Integers LC Hard At-most trick
11 Longest Subarray with Sum K LC Med Prefix sum + map
12 Count Good Meals LC Med Power-of-2 hash
13 Count Nice Pairs in Array LC Med Group by digit-sum diff
14 Random Pick with Blacklist LC Hard Remapping hash
CHAPTER 06
■ Linked Lists
Pointer manipulation, reversal tricks, and fast/slow pointer (Floyd's cycle detection).
■ Problems
# Problem Name Platform Diff Key Concept / Algorithm
1 Reverse Linked List LC Easy Iterative + recursive
2 Merge Two Sorted Lists LC Easy Merge with dummy
3 Linked List Cycle LC Easy Floyd's tortoise-hare
4 Linked List Cycle II LC Med Find cycle entry
5 Find the Duplicate Number LC Med Floyd on array
6 Merge K Sorted Lists LC Hard Min-heap / divide & conquer
7 Remove Nth Node From End LC Med Two-pointer gap
8 Reorder List LC Med Find mid + reverse + merge
9 Copy List with Random Pointer LC Med HashMap / interweave
10 Add Two Numbers LC Med Carry simulation
11 LRU Cache LC Med DLL + HashMap
12 Flatten a Multilevel Doubly Linked List LC Med DFS recursion
13 Sort List LC Med Merge sort on list
14 Palindrome Linked List LC Easy Reverse half + compare
15 Swap Nodes in Pairs LC Med Iterative pointer swap
16 Reverse Nodes in k-Group LC Hard Group reversal
CHAPTER 07
■ Stacks, Queues & Monotonic Structures
Monotonic stack/deque solves next-greater, histogram, and range queries in O(n).
■ Stack Problems
# Problem Name Platform Diff Key Concept / Algorithm
1 Valid Parentheses LC Easy Match brackets
2 Min Stack LC Med Auxiliary min stack
3 Evaluate Reverse Polish Notation LC Med Operator stack
4 Daily Temperatures LC Med Monotonic stack
5 Next Greater Element I/II LC Med Circular mono stack
6 Largest Rectangle in Histogram LC Hard Mono stack spans
7 Maximal Rectangle LC Hard Histogram per row
8 Car Fleet LC Med Stack of times
9 Asteroid Collision LC Med Stack simulation
10 Remove K Digits LC Med Greedy mono stack
11 Remove Duplicate Letters LC Hard Lex smallest + stack
12 Online Stock Span LC Med Weighted mono stack
■ Queue / Deque Problems
# Problem Name Platform Diff Key Concept / Algorithm
13 Sliding Window Maximum LC Hard Monotonic deque
14 Jump Game VI LC Hard DP + deque optimization
15 Shortest Subarray with Sum at Least K LC Hard Prefix + deque
16 Design Circular Queue LC Med Array circular buffer
CHAPTER 08
■ Recursion & Backtracking
Generate all valid states. Pruning is the key to performance.
■ Combinatorics
# Problem Name Platform Diff Key Concept / Algorithm
1 Subsets LC Med Power set backtrack
2 Subsets II (with duplicates) LC Med Sort + skip dups
3 Combinations LC Med Choose k from n
4 Combination Sum I LC Med Unlimited picks
5 Combination Sum II LC Med Exactly once picks
6 Combination Sum III LC Med k digits sum to n
7 Permutations LC Med Swap-based backtrack
8 Permutations II LC Med Freq map backtrack
9 Letter Combinations of Phone Number LC Med Multi-choice backtrack
■ Constraint Satisfaction
# Problem Name Platform Diff Key Concept / Algorithm
10 N-Queens LC Hard Column/diagonal tracking
11 N-Queens II LC Hard Count solutions
12 Sudoku Solver LC Hard Row/col/box sets
13 Word Search LC Med DFS + visited
14 Word Search II LC Hard Trie + DFS
15 Palindrome Partitioning LC Med DP precompute + backtrack
16 Generate Parentheses LC Med Open/close count
17 Path Sum II LC Med Root-leaf DFS
18 Restore IP Addresses LC Med Segment backtrack
19 Beautiful Arrangement LC Med Permutation + check
20 Expression Add Operators LC Hard Eval during backtrack
CHAPTER 09
■ Trees
Binary trees, BSTs, segment trees, and advanced tree algorithms. Covers all traversal types, construction, and path problems.
■ Traversals & Construction
# Problem Name Platform Diff Key Concept / Algorithm
1 Binary Tree Inorder Traversal LC Easy Iterative + Morris
2 Binary Tree Preorder Traversal LC Easy Stack simulation
3 Binary Tree Postorder Traversal LC Easy Two-stack trick
4 Binary Tree Level Order Traversal LC Med BFS with queue
5 Binary Tree Zigzag Level Order LC Med Deque direction flip
6 Binary Tree Right Side View LC Med BFS last per level
7 Average of Levels in Binary Tree LC Easy BFS accumulate
8 Construct BT from Preorder + Inorder LC Med Recursive split
9 Construct BT from Inorder + Postorder LC Med Recursive split
10 Construct BST from Preorder LC Med Bounded recursion
11 Serialize and Deserialize Binary Tree LC Hard BFS / preorder
12 Serialize and Deserialize BST LC Med Preorder + BST prop
■ BST Operations
# Problem Name Platform Diff Key Concept / Algorithm
13 Validate Binary Search Tree LC Med In-order + range
14 Kth Smallest Element in BST LC Med In-order traversal
15 Lowest Common Ancestor of BST LC Med Value comparison
16 Insert into BST LC Med Recursive insert
17 Delete Node in BST LC Med 3-case deletion
18 Convert Sorted Array to BST LC Easy Mid as root
19 Balance a BST LC Med In-order + rebuild
20 Range Sum of BST LC Easy Pruned DFS
21 Two Sum IV - BST LC Easy In-order + hash
22 Recover Binary Search Tree LC Hard Morris + swap 2 nodes
■ Path & Distance Problems
# Problem Name Platform Diff Key Concept / Algorithm
23 Maximum Depth of Binary Tree LC Easy DFS height
24 Minimum Depth of Binary Tree LC Easy BFS first leaf
# Problem Name Platform Diff Key Concept / Algorithm
25 Diameter of Binary Tree LC Easy Max L+R heights
26 Binary Tree Maximum Path Sum LC Hard Global max + branch
27 Path Sum LC Easy DFS subtract
28 Path Sum II LC Med Backtrack DFS
29 Path Sum III LC Med Prefix sum on path
30 Sum Root to Leaf Numbers LC Med DFS accumulate value
31 Count Good Nodes in Binary Tree LC Med Max on path DFS
32 Longest Univalue Path LC Med Match child values
■ Tree Transformations
# Problem Name Platform Diff Key Concept / Algorithm
33 Invert Binary Tree LC Easy Swap children
34 Flatten Binary Tree to Linked List LC Med Morris-like flatten
35 Populating Next Right Pointers LC Med Level BFS
36 Clone Graph (tree version) LC Med DFS clone
37 Convert BST to Greater Tree LC Med Reverse in-order
38 Merge Two Binary Trees LC Easy Simultaneous DFS
39 Leaf-Similar Trees LC Easy DFS leaf sequence
40 Symmetric Tree LC Easy Mirror recursion
■ Advanced Tree Problems
# Problem Name Platform Diff Key Concept / Algorithm
41 Lowest Common Ancestor of Binary Tree LC Med Post-order find
42 Binary Tree Cameras LC Hard Greedy post-order states
43 Distribute Coins in Binary Tree LC Med Excess flow
44 Binary Tree Pruning LC Med Post-order prune
45 Delete Nodes and Return Forest LC Med Post-order + set
46 Maximum Width of Binary Tree LC Med BFS with index
47 All Nodes Distance K in Binary Tree LC Med Parent map + BFS
48 Find Duplicate Subtrees LC Med Serialize + map
49 Subtree of Another Tree LC Easy Serialize or DFS
50 House Robber III LC Med Tree DP rob/skip
■ Segment Tree & BIT (covered deeper in Ch.14)
# Problem Name Platform Diff Key Concept / Algorithm
51 Range Sum Query - Mutable LC Med Segment tree / BIT
52 Count of Smaller Numbers After Self LC Hard Merge sort / BIT
53 Falling Squares LC Hard Segment tree lazy
CHAPTER 10
■■ Graphs
BFS, DFS, Dijkstra, Bellman-Ford, Floyd-Warshall, topological sort, SCC, and more. The richest topic in CP.
■ Graph Traversal (BFS/DFS)
# Problem Name Platform Diff Key Concept / Algorithm
1 Number of Islands LC Med DFS/BFS flood fill
2 Clone Graph LC Med BFS with hash map
3 Max Area of Island LC Med DFS area count
4 Flood Fill LC Easy DFS color change
5 Surrounded Regions LC Med Border DFS then flip
6 Pacific Atlantic Water Flow LC Med Reverse BFS from both
7 Number of Closed Islands LC Med DFS exclude border
8 Is Graph Bipartite? LC Med BFS 2-coloring
9 Find the Town Judge LC Easy In-degree = n-1, out = 0
10 Find Center of Star Graph LC Easy Common in two edges
■ Shortest Paths
# Problem Name Platform Diff Key Concept / Algorithm
11 Network Delay Time LC Med Dijkstra
12 Path with Minimum Effort LC Med Dijkstra variant
13 Cheapest Flights Within K Stops LC Med Bellman-Ford / Dijkstra
14 Minimum Cost to Reach Destination LC Hard Dijkstra on (node,stops)
15 Swim in Rising Water LC Hard Binary search + BFS / Dijkstra
16 Shortest Path in Binary Matrix LC Med BFS on 0-cells
17 Word Ladder LC Hard BFS on word graph
18 Word Ladder II LC Hard BFS layer + DFS paths
19 01 BFS (CF 1067B) CF Med Deque BFS for 0/1 edges
20 Floyd Warshall - Find the City LC Med All-pairs shortest path
21 Shortest Path with Alternating Colors LC Med BFS bipartite edge
22 K-th Shortest Path (Yen's / Dijkstra) CF Hard Heap extension
■ Topological Sort & DAGs
# Problem Name Platform Diff Key Concept / Algorithm
23 Course Schedule LC Med Cycle detection Kahn's
24 Course Schedule II LC Med Kahn's BFS topo sort
# Problem Name Platform Diff Key Concept / Algorithm
25 Course Schedule IV LC Med Transitive closure
26 Alien Dictionary LC Hard Build graph + topo
27 Sequence Reconstruction LC Med Unique topo order
28 Minimum Height Trees LC Med Leaf trimming topo
29 Parallel Courses LC Med Kahn's + level count
30 Longest Path in DAG CF Med DP on topo order
■ Union Find (DSU)
# Problem Name Platform Diff Key Concept / Algorithm
31 Number of Provinces LC Med Basic DSU
32 Redundant Connection LC Med Cycle via DSU
33 Accounts Merge LC Med DSU + map
34 Smallest String with Swaps LC Med DSU group anagram
Number of Operations to Make Network
35 LC Med DSU count components
Connected
36 Satisfiability of Equality Equations LC Med DSU on chars
37 Minimum Spanning Tree (Kruskal) CF Med Sort edges + DSU
38 Minimum Risk Path CF Med MST / DSU + sort
■ Advanced Graph Algorithms
# Problem Name Platform Diff Key Concept / Algorithm
39 Critical Connections in a Network LC Hard Tarjan's bridge finding
Number of Strongly Connected
40 LC Hard Kosaraju's / Tarjan's SCC
Components
41 Articulation Points CF Hard Tarjan's low-link
42 Euler Path / Circuit CF Med Hierholzer's algorithm
43 Minimum Spanning Tree (Prim's) CF Med Min-heap Prim's
44 Dijkstra on Implicit Graph CF Med State-space search
45 SPFA / Bellman-Ford - Negative Cycle CF Med Queue relax
46 Bipartite Matching (Hopcroft-Karp) CF Hard Augment paths BFS
47 Max Flow / Min Cut (Dinic's) CF Hard BFS layering + DFS push
48 Assignment Problem CF Hard Hungarian / min-cost flow
■ Grid & Matrix Graphs
# Problem Name Platform Diff Key Concept / Algorithm
49 Rotting Oranges LC Med Multi-source BFS
# Problem Name Platform Diff Key Concept / Algorithm
50 01 Matrix LC Med Multi-source BFS
51 Jump Game III LC Med BFS reachability
52 Shortest Bridge LC Hard DFS island 1 + BFS expand
Minimum Moves to Reach Target with
53 LC Hard BFS on (r,c,dir)
Rotations
54 Snakes and Ladders LC Med BFS flatten board
CHAPTER 11
■ Dynamic Programming
The most important topic for competitive programming. Master all DP patterns: 1D, 2D, interval, digit, bitmask, tree, and
optimization tricks.
■ 1D DP Fundamentals
# Problem Name Platform Diff Key Concept / Algorithm
1 Climbing Stairs LC Easy Fibonacci DP
2 House Robber LC Med No adjacent pick
3 House Robber II (circular) LC Med Two runs
4 Decode Ways LC Med Valid decode count
5 Jump Game LC Med Greedy / reachability DP
6 Jump Game II LC Med BFS / greedy DP
7 Coin Change LC Med Unbounded knapsack
8 Coin Change II (count ways) LC Med Unbounded knapsack ways
9 Perfect Squares LC Med BFS / DP min coins
10 Minimum Cost Climbing Stairs LC Easy Two-state DP
■ Subsequence & String DP
# Problem Name Platform Diff Key Concept / Algorithm
11 Longest Common Subsequence LC Med Classic 2D DP
12 Longest Increasing Subsequence LC Med DP O(n²) + patience O(n log n)
13 Number of LIS LC Hard DP count with length
14 Edit Distance LC Hard 3-operation DP
15 Distinct Subsequences LC Hard Inclusion DP
16 Interleaving String LC Hard 2D DP match
17 Shortest Common Supersequence LC Hard LCS + reconstruct
18 Regular Expression Matching LC Hard DP with wildcards
19 Wildcard Matching LC Hard * can match sequence
20 Longest Palindromic Subsequence LC Med Reverse + LCS
■ Interval & Partition DP
# Problem Name Platform Diff Key Concept / Algorithm
21 Burst Balloons LC Hard Interval DP multiply
22 Strange Printer LC Hard Interval DP characters
23 Minimum Cost to Cut a Stick LC Hard Interval DP cut cost
# Problem Name Platform Diff Key Concept / Algorithm
24 Palindrome Partitioning II LC Hard Interval + 1D DP
Minimum Insertion Steps to Make
25 LC Hard LPS complement
Palindrome
26 Stone Merge (classic CF) CF Hard Interval DP O(n^3)
27 Matrix Chain Multiplication CF Hard Classic interval DP
28 Optimal BST CF Hard Knuth's optimization O(n^2)
■ Knapsack Variants
# Problem Name Platform Diff Key Concept / Algorithm
29 0/1 Knapsack CF Med Item pick once
30 Unbounded Knapsack CF Med Infinite picks
31 Bounded Knapsack CF Hard Binary grouping
32 Partition Equal Subset Sum LC Med 0/1 KS to target
33 Target Sum LC Med Count subset sum DP
34 Last Stone Weight II LC Med Partition halves
35 Ones and Zeroes LC Med 2D knapsack (m,n)
36 Profitable Schemes LC Hard 3D DP knapsack
■ Grid & 2D DP
# Problem Name Platform Diff Key Concept / Algorithm
37 Unique Paths LC Med Pascal grid
38 Unique Paths II (obstacles) LC Med Grid DP with wall
39 Minimum Path Sum LC Med Grid min cost
40 Triangle Minimum Path LC Med Bottom-up triangle
41 Maximal Square LC Med Largest 1-square DP
42 Dungeon Game LC Hard Reverse DP
43 Cherry Pickup LC Hard Two-walker simultaneous DP
44 Cherry Pickup II LC Hard Two-walker grid DP
■ Digit DP
# Problem Name Platform Diff Key Concept / Algorithm
45 Count Numbers with Unique Digits LC Med Digit DP intro
46 Numbers At Most N Given Digit Set LC Hard Digit DP limit
Non-negative Integers without Consecutive
47 LC Hard Digit bitmask DP
Ones
48 Count Special Integers LC Hard Classic digit DP
# Problem Name Platform Diff Key Concept / Algorithm
49 CF 1073E - Sum of Divisors Digit DP CF Hard Digit DP summation
■ Bitmask DP
# Problem Name Platform Diff Key Concept / Algorithm
50 Traveling Salesman Problem CF Hard TSP DP 2^n
51 Maximum AND Sum of Array LC Hard Bitmask assignment
52 Find Minimum Cost to Remove Boxes LC Hard 3D interval + state
53 Stickers to Spell Word LC Hard Bitmask coverage
54 Shortest Superstring LC Hard TSP-style bitmask DP
■ DP Optimization
# Problem Name Platform Diff Key Concept / Algorithm
55 Largest Divisible Subset LC Med LIS-style DP
56 Arithmetic Slices II - Subsequence LC Hard Map-based DP
57 Count Vowels Permutation LC Hard State machine DP
CF 1017E - Sum of Squares (Convex Hull
58 CF Hard CHT / Li Chao tree
Trick)
59 Divide Chocolate (DP + BS) LC Hard Binary search + DP
CF 660F - Bear and Bowling (Aliens Trick /
60 CF Hard WQS binary search
Lambda opt)
CHAPTER 12
■ Greedy Algorithms (Advanced)
Exchange argument proofs, scheduling theory, and greedy on graphs.
■ Scheduling
# Problem Name Platform Diff Key Concept / Algorithm
1 Job Sequencing with Deadlines CF Med Sort profit + DSU slot
2 Minimum Number of Platforms CF Med Event sort
3 Course Schedule III LC Hard Heap drop greedy
4 IPO - Maximize Capital LC Hard Two-heap greedy
5 Reorganize String LC Med Max-heap interleave
6 Rearrange String k Distance Apart LC Hard Heap scheduling
■ Greedy Proofs & Miscellaneous
# Problem Name Platform Diff Key Concept / Algorithm
7 Minimum Swaps to Sort Array CF Med Cycle decomposition
8 Broken Necklace CF Med Greedy string
9 CF 1374D - Zero-Sum Prefixes CF Med Greedy + prefix logic
10 Maximum Trains (greedy sort) CF Med Sort + simulate
11 Maximize Sum of Array After K Negations LC Med Sort + flip min
12 Minimum Cost to Connect Sticks LC Med Huffman / min-heap
CHAPTER 13
■■ Heaps & Priority Queues
Top-K, median streams, lazy deletion, and heap-based graph algorithms.
■ Problems
# Problem Name Platform Diff Key Concept / Algorithm
1 Kth Largest Element in an Array LC Med Quickselect / min-heap
2 Kth Largest in a Stream LC Easy Min-heap of size k
3 Find Median from Data Stream LC Hard Two heaps
4 Sliding Window Median LC Hard Two heaps + lazy delete
5 Top K Frequent Elements LC Med Bucket / min-heap
6 Top K Frequent Words LC Med Heap + custom comparator
7 K Closest Points to Origin LC Med Max-heap of size k
8 Merge K Sorted Lists LC Hard Min-heap
9 Ugly Number II LC Med Three-pointer / heap
10 Super Ugly Number LC Med K-way heap
11 Trapping Rain Water II (3D) LC Hard Min-heap BFS
12 Meeting Rooms II LC Med Min-heap end times
13 Task Scheduler LC Med Max-heap simulation
14 Furthest Building You Can Reach LC Med Heap + greedy swap
15 Minimum Cost to Hire K Workers LC Hard Sort + sliding heap
CHAPTER 14
■ Tries (Prefix Trees)
Efficient prefix lookup, XOR tries, and suffix arrays.
■ Problems
# Problem Name Platform Diff Key Concept / Algorithm
1 Implement Trie LC Med Insert / search / prefix
2 Design Add and Search Words LC Med Wildcard search in trie
3 Word Search II LC Hard Trie + DFS backtrack
4 Replace Words LC Med Trie prefix replacement
5 Map Sum Pairs LC Med Trie with values
6 Maximum XOR of Two Numbers LC Med Bit trie
Maximum XOR With an Element From
7 LC Hard Online bit trie
Array
8 Prefix and Suffix Search LC Hard Dual trie / suffix wrap
9 Stream of Characters LC Hard Aho-Corasick / reverse trie
CF 755E - Almost Optimal Longest
10 CF Hard Suffix array + sparse table
Common Prefix
11 Short Encoding of Words LC Med Suffix trie
12 Count Words With a Given Prefix LC Easy Trie prefix count
CHAPTER 15
■■ Segment Trees & Binary Indexed Trees
(BIT/Fenwick)
Range queries and point updates in O(log n). Lazy propagation for range updates.
■ Binary Indexed Tree (Fenwick)
# Problem Name Platform Diff Key Concept / Algorithm
1 Range Sum Query - Mutable LC Med BIT point update range sum
2 Count of Smaller Numbers After Self LC Hard Offline BIT / merge sort
3 Count of Range Sum LC Hard Merge sort / BIT
4 Reverse Pairs LC Hard Merge sort / BIT
5 Create Sorted Array through Instructions LC Hard BIT insertion count
■ Segment Tree
# Problem Name Platform Diff Key Concept / Algorithm
6 Range Minimum Query CF Med Basic segment tree
7 Range Sum with Lazy Propagation CF Med Lazy segment tree
8 Falling Squares LC Hard Coordinate compress + seg tree
9 My Calendar III LC Hard Segment tree / sweep
10 The Skyline Problem LC Hard Segment tree / priority queue
11 Rectangle Area II LC Hard Coordinate compress + seg tree
12 CF 380C - Sereja and Brackets CF Hard Seg tree with struct merge
13 CF 242E - XOR on Segment CF Hard Seg tree XOR lazy
14 Persistent Segment Tree (CF) CF Hard Merge sort tree / persistent
CHAPTER 16
■ Math & Number Theory
Modular arithmetic, primes, GCD, combinatorics, and fast exponentiation are staples of CP.
■ Modular Arithmetic & Combinatorics
# Problem Name Platform Diff Key Concept / Algorithm
1 Pow(x,n) - Fast Exponentiation LC Med Binary exponentiation
2 Pascal's Triangle LC Easy nCr recurrence
3 Count Ways to Select Items (nCr mod p) CF Med Factorial inverse mod p
4 Catalan Number Applications CF Med Dyck paths / BST count
5 Factorial Trailing Zeroes LC Med Count factor-5
6 Super Pow (modular) LC Med Chinese Remainder approach
■ Primes & Divisors
# Problem Name Platform Diff Key Concept / Algorithm
7 Sieve of Eratosthenes CF Easy Classic prime sieve
8 Linear Sieve (smallest prime factor) CF Med Factorize in O(n)
9 Count Primes LC Med Sieve up to n
10 Ugly Number II LC Med 3-pointer / heap
Largest Component Size by Common
11 LC Hard DSU + factors
Factor
12 GCD and LCM Problems CF Easy Euclidean algorithm
13 Minimum Number of Operations (GCD) CF Med GCD invariant
■ Integer Tricks
# Problem Name Platform Diff Key Concept / Algorithm
14 Reverse Integer LC Med Overflow detection
15 Palindrome Number LC Easy Digit reversal
16 Happy Number LC Easy Floyd cycle on digit sum
17 Missing Number LC Easy XOR / Gauss sum
18 Single Number LC Easy XOR cancel pairs
19 Single Number II LC Med 32-bit vote counting
20 Sum of Two Integers (no +) LC Med Bit carry simulation
CHAPTER 17
■■ Bit Manipulation
Bitmask DP, XOR tricks, and low-level optimizations that frequently appear in CF rounds.
■ Problems
# Problem Name Platform Diff Key Concept / Algorithm
1 Number of 1 Bits LC Easy Brian Kernighan / popcount
2 Counting Bits LC Easy DP with LSB
3 Reverse Bits LC Easy Iterative shift
4 Power of Two LC Easy n & (n-1) == 0
5 Maximum XOR of Two Numbers in Array LC Med Bit trie
6 XOR Queries of a Subarray LC Med Prefix XOR
7 Minimum XOR Sum (bitmask DP) LC Hard State assignment DP
8 Subsets via Bitmask LC Med Enumerate 2^n masks
9 Divide Two Integers LC Med Bit shift division
10 Bitwise AND of Numbers Range LC Med Common prefix
11 Smallest Sufficient Team LC Hard Bitmask coverage DP
12 Maximum Score Words (bitmask) LC Hard Bitmask subset eval
13 Number of Excellent Pairs (CF 1538F) CF Hard Bit popcount + count
CHAPTER 18
■ Advanced String Algorithms
KMP, Z-algorithm, Rabin-Karp hashing, suffix arrays, and Aho-Corasick automaton.
■ Pattern Matching
# Problem Name Platform Diff Key Concept / Algorithm
Find the Index of the First Occurrence
1 LC Easy KMP failure function
(KMP)
2 Repeated Substring Pattern (KMP) LC Easy KMP period
3 Shortest Palindrome (KMP) LC Hard KMP on concat
4 Z-Function Applications CF Med Z-array pattern count
5 Rabin-Karp Rolling Hash CF Med Multiple pattern search
Longest Duplicate Substring (BS +
6 LC Hard Binary search + hash
Rabin-Karp)
■ Suffix Structures
# Problem Name Platform Diff Key Concept / Algorithm
7 Longest Common Prefix (Suffix Array) CF Hard SA + LCP (Kasai)
8 Number of Distinct Substrings CF Hard SA + LCP formula
9 Longest Repeated Substring CF Hard Binary search + SA
■ Automata
# Problem Name Platform Diff Key Concept / Algorithm
10 Aho-Corasick (Multi-pattern search) CF Hard Failure links automaton
11 Word Break (trie DP) LC Med Trie + DP
12 Word Break II LC Hard Trie + backtrack + memo
■ Hashing & Misc
# Problem Name Platform Diff Key Concept / Algorithm
13 Longest Happy Prefix (KMP/Z) LC Hard KMP prefix = suffix
14 Minimum Window Substring LC Hard Sliding window
15 Count and Say LC Med Run-length encoding
16 String Compression LC Med Two-pointer encode
CHAPTER 19
■ Disjoint Set Union (DSU) & Advanced
Union by rank + path compression. Offline problems, Kruskal's MST, and dynamic connectivity.
■ DSU Problems
# Problem Name Platform Diff Key Concept / Algorithm
1 Number of Provinces LC Med Basic DSU
2 Redundant Connection LC Med Cycle detection
3 Redundant Connection II (directed) LC Hard Directed cycle find
4 Most Stones Removed with Same Row/Col LC Med DSU on coords
Number of Operations to Make Network
5 LC Med Component count
Connected
6 Accounts Merge LC Med Email grouping DSU
7 Swim in Rising Water LC Hard Sort events + DSU
8 Remove Max Number of Edges LC Hard DSU type 3 first
9 Kruskal MST on general graph CF Med Sort + DSU
10 Online DSU (rollback for tree) CF Hard DSU with rollback
■ Game Theory
# Problem Name Platform Diff Key Concept / Algorithm
11 Nim Game LC Easy XOR sum = 0 loses
12 Stone Game LC Med Parity / minimax DP
13 Stone Game II LC Med DP with suffix sum
14 Sprague-Grundy (Grundy values) CF Hard XOR of Grundy numbers
15 Predict the Winner LC Med Interval minimax DP
16 Can I Win LC Med Bitmask memo
CHAPTER 20
■ CP Meta — Contest Strategy & Advanced Topics
Speed coding, complexity analysis, square root decomposition, meets-in-the-middle, and contest mindset.
■ Square Root Decomposition
# Problem Name Platform Diff Key Concept / Algorithm
1 Mo's Algorithm (offline range queries) CF Hard Block sqrt queries
2 SQRT Decomposition Range Sum CF Med Block arrays
3 CF 940F - Machine Learning CF Hard Mo's + BIT offline
■ Meets in the Middle
# Problem Name Platform Diff Key Concept / Algorithm
4 Partition to K Equal Sum Subsets LC Hard Meet-in-middle bitmask
5 4-Sum (meet in middle) LC Hard Split pairs hash
6 CF 1006F - Xor-Paths CF Hard MITM on XOR paths
■ Miscellaneous Important Algorithms
# Problem Name Platform Diff Key Concept / Algorithm
7 Sparse Table (RMQ O(1) query) CF Med Static range min/max
8 Heavy-Light Decomposition CF Hard HLD + seg tree on paths
9 Centroid Decomposition CF Hard Divide tree by centroid
10 Euler Tour + LCA (Binary Lifting) CF Hard Ancestor queries
11 Offline LCA (Tarjan's offline) CF Hard DSU on DFS
12 Convex Hull Trick (DP opt) CF Hard Minimize linear functions
13 Li Chao Tree CF Hard Online convex hull trick
14 Divide and Conquer DP Opt CF Hard Monotone cut pointer
CF 1550F - Even Odd Queries (offline +
15 CF Hard Offline range queries
BIT)
■ 30-Day Study Roadmap
# Problem Name Platform Diff Key Concept / Algorithm
Week 1-2: Arrays, Strings, Binary Search,
16 — — ~60 problems
Hashing
Week 3-4: Stacks, Queues, Linked Lists,
17 — — ~50 problems
Recursion
18 Week 5-6: Trees (all types) + Basic Graphs — — ~60 problems
# Problem Name Platform Diff Key Concept / Algorithm
Week 7-8: Advanced Graphs + DP
19 — — ~60 problems
fundamentals
Week 9-10: Advanced DP + Segment Trees
20 — — ~50 problems
+ BIT
21 Week 11-12: Math, Strings, Tries, Bitmask — — ~40 problems
Week 13-16: Hard problems + CF contests
22 — — Virtual contests
daily