Loading repovive.com/roadmaps/leetcode-hard-problem-solving
Roadmaps
LeetCode Hard Problem Solving
Premium
Problemset
Discussion
AI Helper
Getting Started
0/5
1
Who This Is For
2
Intro
3
What You'll Learn
4
How to Use This Roadmap
5
Section Recap
Binary Search
0/49
1
Introduction to Hard Binary Search
2
When to Use Binary Search
3
Problem - Median of Two Sorted Arrays
4
Median of Two Sorted Arrays - Why Naive Fails
5
Median of Two Sorted Arrays - Partition Logic
6
Median of Two Sorted Arrays - Implementation
7
Median of Two Sorted Arrays - Time and Space
8
Problem - Split Array Largest Sum
9
Split Array Largest Sum - Why Naive Fails
10
Split Array Largest Sum - Feasibility Check
11
Split Array Largest Sum - Implementation
12
Split Array Largest Sum - Time and Space
13
Problem - Find K-th Smallest Pair Distance
14
Find K-th Smallest Pair Distance - Why Naive Fails
15
Find K-th Smallest Pair Distance - Counting Pairs
16
Find K-th Smallest Pair Distance - Implementation
17
Find K-th Smallest Pair Distance - Time and Space
18
Problem - Kth Smallest Number in Multiplication Table
19
Kth Smallest in Multiplication Table - Counting Logic
20
Kth Smallest in Multiplication Table - Implementation
21
Kth Smallest in Multiplication Table - Time and Space
22
Problem - Super Egg Drop
23
Super Egg Drop - Why Naive Fails
24
Super Egg Drop - Binary Search Optimization
25
Super Egg Drop - Implementation
26
Super Egg Drop - Time and Space
27
Problem - Russian Doll Envelopes
28
Russian Doll Envelopes - Reduction to LIS
29
Russian Doll Envelopes - Implementation
30
Russian Doll Envelopes - Time and Space
31
Problem - Maximum Profit in Job Scheduling
32
Maximum Profit in Job Scheduling - DP Setup
33
Maximum Profit in Job Scheduling - Implementation
34
Maximum Profit in Job Scheduling - Time and Space
35
Problem - Maximum Running Time of N Computers
36
Maximum Running Time - Feasibility Check
37
Maximum Running Time - Implementation
38
Maximum Running Time - Time and Space
39
Problem - House Robber IV
40
House Robber IV - Feasibility Check
41
House Robber IV - Implementation
42
House Robber IV - Time and Space
43
Problem - Maximize the Minimum Powered City
44
Maximize Minimum Powered City - Feasibility Check
45
Maximize Minimum Powered City - Implementation
46
Maximize Minimum Powered City - Time and Space
47
Quiz: Binary Search Patterns
48
Common Mistakes in Binary Search
49
Section Recap
Backtracking
0/48
1
Introduction to Hard Backtracking
2
When to Use Backtracking
3
Problem - N-Queens
4
N-Queens - Why Naive Fails
5
N-Queens - Constraint Tracking
6
N-Queens - Implementation
7
N-Queens - Time and Space
8
Problem - Sudoku Solver
9
Sudoku Solver - Constraint Representation
10
Sudoku Solver - Implementation
11
Sudoku Solver - Time and Space
12
Problem - Word Search II
13
Word Search II - Why Naive Fails
14
Word Search II - Trie Structure
15
Word Search II - Implementation
16
Word Search II - Time and Space
17
Problem - Regular Expression Matching
18
Regular Expression Matching - Why It's Hard
19
Regular Expression Matching - Recursive Structure
20
Regular Expression Matching - Implementation
21
Regular Expression Matching - Time and Space
22
Problem - Expression Add Operators
23
Expression Add Operators - Handling Precedence
24
Expression Add Operators - Implementation
25
Expression Add Operators - Time and Space
26
Problem - Remove Invalid Parentheses
27
Remove Invalid Parentheses - Counting Removals
28
Remove Invalid Parentheses - Implementation
29
Remove Invalid Parentheses - Time and Space
30
Problem - Word Break II
31
Word Break II - Why Naive Fails
32
Word Break II - Implementation
33
Word Break II - Time and Space
34
Problem - Word Ladder II
35
Word Ladder II - Two-Phase Approach
36
Word Ladder II - Implementation
37
Word Ladder II - Time and Space
38
Problem - Partition to K Equal Sum Subsets
39
Partition to K Equal Sum Subsets - Pruning Strategies
40
Partition to K Equal Sum Subsets - Implementation
41
Partition to K Equal Sum Subsets - Time and Space
42
Problem - Unique Paths III
43
Unique Paths III - Counting Cells
44
Unique Paths III - Implementation
45
Unique Paths III - Time and Space
46
Quiz: Backtracking Patterns
47
Common Mistakes in Backtracking
48
Section Recap
Greedy
0/45
1
Introduction to Hard Greedy
2
When to Use Greedy
3
Problem - Candy
4
Candy - Two-Pass Approach
5
Candy - Implementation
6
Candy - Time and Space
7
Problem - IPO
8
IPO - Greedy with Two Heaps
9
IPO - Implementation
10
IPO - Time and Space
11
Problem - Course Schedule III
12
Course Schedule III - Greedy with Exchange
13
Course Schedule III - Implementation
14
Course Schedule III - Time and Space
15
Problem - Minimum Number of Refueling Stops
16
Minimum Refueling Stops - Deferred Decision
17
Minimum Refueling Stops - Implementation
18
Minimum Refueling Stops - Time and Space
19
Problem - Patching Array
20
Patching Array - Coverage Extension
21
Patching Array - Implementation
22
Patching Array - Time and Space
23
Problem - Create Maximum Number
24
Create Maximum Number - Two Subproblems
25
Create Maximum Number - Implementation
26
Create Maximum Number - Time and Space
27
Problem - Binary Tree Cameras
28
Binary Tree Cameras - Bottom-Up Greedy
29
Binary Tree Cameras - Implementation
30
Binary Tree Cameras - Time and Space
31
Problem - Maximum Performance of a Team
32
Maximum Performance - Fix and Optimize
33
Maximum Performance - Implementation
34
Maximum Performance - Time and Space
35
Problem - Minimum Cost to Hire K Workers
36
Minimum Cost to Hire K Workers - Ratio Strategy
37
Minimum Cost to Hire K Workers - Implementation
38
Minimum Cost to Hire K Workers - Time and Space
39
Problem - Reducing Dishes
40
Reducing Dishes - Backwards Greedy
41
Reducing Dishes - Implementation
42
Reducing Dishes - Time and Space
43
Quiz: Greedy Patterns
44
Common Mistakes in Greedy
45
Section Recap
Monotonic Stack
0/45
1
Introduction to Monotonic Stack
2
When to Use Monotonic Stack
3
Problem - Largest Rectangle in Histogram
4
Largest Rectangle in Histogram - Core Idea
5
Largest Rectangle in Histogram - Implementation
6
Largest Rectangle in Histogram - Time and Space
7
Problem - Trapping Rain Water
8
Trapping Rain Water - Stack Approach
9
Trapping Rain Water - Implementation
10
Trapping Rain Water - Time and Space
11
Problem - Maximal Rectangle
12
Maximal Rectangle - Reduction to Histogram
13
Maximal Rectangle - Implementation
14
Maximal Rectangle - Time and Space
15
Problem - Sum of Total Strength of Wizards
16
Sum of Total Strength - Contribution Formula
17
Sum of Total Strength - Implementation
18
Sum of Total Strength - Time and Space
19
Problem - Number of Visible People in Queue
20
Number of Visible People - Stack Logic
21
Number of Visible People - Implementation
22
Number of Visible People - Time and Space
23
Problem - Sliding Window Maximum
24
Sliding Window Maximum - Monotonic Deque
25
Sliding Window Maximum - Implementation
26
Sliding Window Maximum - Time and Space
27
Problem - Sum of Subarray Minimums
28
Sum of Subarray Minimums - Contribution Counting
29
Sum of Subarray Minimums - Implementation
30
Sum of Subarray Minimums - Time and Space
31
Problem - Maximum Subarray Min-Product
32
Maximum Subarray Min-Product - Approach
33
Maximum Subarray Min-Product - Implementation
34
Maximum Subarray Min-Product - Time and Space
35
Problem - 132 Pattern
36
132 Pattern - Right-to-Left Stack
37
132 Pattern - Implementation
38
132 Pattern - Time and Space
39
Problem - Max Chunks to Make Sorted II
40
Max Chunks to Make Sorted II - Stack Approach
41
Max Chunks to Make Sorted II - Implementation
42
Max Chunks to Make Sorted II - Time and Space
43
Quiz: Monotonic Stack Patterns
44
Common Mistakes in Monotonic Stack
45
Section Recap
Hashmap
0/45
1
Introduction to Hard Hashmap Problems
2
When Hashmaps Solve Hard Problems
3
Problem - Minimum Window Substring
4
Minimum Window Substring - Sliding Window with Map
5
Minimum Window Substring - Implementation
6
Minimum Window Substring - Time and Space
7
Problem - Subarrays with K Different Integers
8
Subarrays with K Different - At Most K Trick
9
Subarrays with K Different - Implementation
10
Subarrays with K Different - Time and Space
11
Problem - First Missing Positive
12
First Missing Positive - Array as Hashmap
13
First Missing Positive - Implementation
14
First Missing Positive - Time and Space
15
Problem - Substring with Concatenation of All Words
16
Substring with Concatenation - Word-Level Sliding Window
17
Substring with Concatenation - Implementation
18
Substring with Concatenation - Time and Space
19
Problem - LRU Cache
20
LRU Cache - Hashmap Plus Doubly Linked List
21
LRU Cache - Implementation
22
LRU Cache - Time and Space
23
Problem - LFU Cache
24
LFU Cache - Frequency Buckets
25
LFU Cache - Implementation
26
LFU Cache - Time and Space
27
Problem - Max Points on a Line
28
Max Points on a Line - Slope Hashing
29
Max Points on a Line - Implementation
30
Max Points on a Line - Time and Space
31
Problem - Longest Consecutive Sequence
32
Longest Consecutive - Start of Sequence
33
Longest Consecutive - Implementation
34
Longest Consecutive - Time and Space
35
Problem - Contains Duplicate III
36
Contains Duplicate III - Bucket Approach
37
Contains Duplicate III - Implementation
38
Contains Duplicate III - Time and Space
39
Problem - Naming a Company
40
Naming a Company - Group by First Letter
41
Naming a Company - Implementation
42
Naming a Company - Time and Space
43
Quiz: Hashmap Techniques
44
Common Mistakes in Hashmap Problems
45
Section Recap