Sets
Learn what sets are, how to write them, and set operations: union, intersection, and difference.
Lessons
1. Intro
Why sets matter
2. What Is a Set?
Unordered unique collection
3. Set Notation
Curly braces
4. Vocabulary - Element
Member of a set
5. Empty Set
Set with nothing
6. Set-Builder Notation
Defining with rules
7. Vocabulary - Cardinality
Number of elements
8. Vocabulary - Subset
All elements contained
9. Proper Subset
Subset but not equal
10. Set Equality
Same elements
11. Vocabulary - Union
Combine both sets
12. Vocabulary - Intersection
Common elements only
13. Vocabulary - Difference
Elements in first only
14. Vocabulary - Complement
Everything not in set
15. Symmetric Difference
Either set not both
16. Venn Diagrams
Visual representation
17. Power Set
Set of all subsets
18. De Morgan's Laws
Complement identities
19. Sets in Programming
Hash sets and tree sets
20. Quiz: Set Basics
Knowledge check
21. Problem - Intersection of Two Arrays
LeetCode 349
22. Intersection - The Idea
Membership check
23. Intersection - Implementation
Hash set solution
24. Lessons from Intersection
summary
25. Problem - Find Difference
LeetCode 2215
26. Difference - The Idea
Two-way difference
27. Difference - Implementation
Two set subtractions
28. Lessons from Difference
summary
29. Quiz: Set Operations
Knowledge check
30. Problem - Set Mismatch
LeetCode 645
31. Mismatch - The Idea
Frequency tracking
32. Mismatch - Implementation
Frequency array
33. Lessons from Mismatch
summary
34. Problem - Longest Consecutive
LeetCode 128
35. Consecutive - Core Idea 1
Start of sequence
36. Consecutive - Core Idea 2
Counting forward
37. Consecutive - Implementation
Smart iteration
38. Lessons from Consecutive
summary
39. Quiz: Advanced Sets
Knowledge check
40. When to Use Sets
Problem patterns
41. Section Recap
What we learned