Union Find
Problems using union find (disjoint set) data structure
40 lessons
110 min
Lessons
1. What is Union Find
Pattern overview
2m
2. Prerequisites
What you need first
1m
3. When to Use
Pattern triggers
2m
4. When NOT to Use
Avoid forcing this pattern
2m
5. LeetCode 1971 Find if Path Exists - Problem Statement
The problem
3m1 problems
6. LeetCode 1971 Find if Path Exists - Solution
The pattern
4m
7. LeetCode 1971 Find if Path Exists - Example and Complexity Analysis
Walkthrough and analysis
3m
8. LeetCode 1971 Find if Path Exists - Implementation
The code
4m1 problems
9. LeetCode 547 Number of Provinces - Problem Statement
The problem
2m1 problems
10. Quiz: Counting Components
Test your understanding
2m1 problems
11. LeetCode 547 Number of Provinces - Solution
The core idea
3m
12. LeetCode 547 Number of Provinces - Example and Complexity Analysis
Walkthrough and analysis
3m
13. LeetCode 547 Number of Provinces - Implementation
The approach
4m1 problems
14. LeetCode 721 Accounts Merge - Problem Statement
The problem
2m1 problems
15. LeetCode 721 Accounts Merge - Why Naive Fails
The trap
2m
16. LeetCode 721 Accounts Merge - Solution
The core idea
3m
17. LeetCode 721 Accounts Merge - Example and Complexity Analysis
Walkthrough and analysis
3m
18. LeetCode 721 Accounts Merge - Implementation
The approach
4m1 problems
19. LeetCode 1319 Number of Operations to Make Network Connected - Problem Statement
The problem
2m1 problems
20. LeetCode 1319 Number of Operations to Make Network Connected - Why Naive Fails
The trap
2m
21. LeetCode 1319 Number of Operations to Make Network Connected - Solution
The core idea
3m
22. LeetCode 1319 Number of Operations to Make Network Connected - Example and Complexity Analysis
Walkthrough and analysis
3m
23. LeetCode 1319 Number of Operations to Make Network Connected - Implementation
The approach
4m1 problems
24. LeetCode 684 Redundant Connection - Problem Statement
The problem
2m1 problems
25. Quiz: Detecting Redundant Edge
Test your understanding
2m1 problems
26. LeetCode 684 Redundant Connection - Why Naive Fails
The trap
2m
27. LeetCode 684 Redundant Connection - Solution
The core idea
3m
28. LeetCode 684 Redundant Connection - Example and Complexity Analysis
Walkthrough and analysis
3m
29. LeetCode 684 Redundant Connection - Implementation
The approach
4m1 problems
30. LeetCode 778 Swim in Rising Water - Problem Statement
The problem
3m1 problems
31. LeetCode 778 Swim in Rising Water - Solution
The pattern
4m
32. LeetCode 778 Swim in Rising Water - Example and Complexity Analysis
Walkthrough and analysis
3m
33. LeetCode 778 Swim in Rising Water - Implementation
The code
4m1 problems
34. LeetCode 947 Most Stones Removed with Same Row or Column - Problem Statement
The problem
2m1 problems
35. LeetCode 947 Most Stones Removed with Same Row or Column - Why Naive Fails
The trap
2m
36. LeetCode 947 Most Stones Removed with Same Row or Column - Solution
The core idea
3m
37. LeetCode 947 Most Stones Removed with Same Row or Column - Example and Complexity Analysis
Walkthrough and analysis
3m
38. LeetCode 947 Most Stones Removed with Same Row or Column - Implementation
The approach
4m1 problems
39. Common Mistakes
Common errors to avoid
2m
40. Section Recap
Summary
1m
Practice Problems
1.
2.
4.
6.
7.
9.
10.
11.
12.