Arithmetic & Modulo
Learn the building blocks: operations, order of operations (PEMDAS), and modular arithmetic basics.
Lessons
1. Intro
The Goal
2. Basic Operations
Addition through division
3. Order of Operations
PEMDAS rules
4. Quiz: Order of Operations
Knowledge check
5. Integer Division
Discarding the remainder
6. Vocabulary - Floor
Rounding down
7. Vocabulary - Ceiling
Rounding up
8. The Modulo Operator
Getting the remainder
9. Modulo Examples
Concrete calculations
10. Quiz: Modulo Basics
Knowledge check
11. Pattern - Even and Odd
Using modulo 2
12. Pattern - Cyclic Behavior
Wrapping around
13. Properties of Modulo
Addition and multiplication
14. Why Properties Matter
Preventing overflow
15. Negative Numbers and Modulo
Language differences
16. Quiz: Modulo Properties
Knowledge check
17. Problem - Power of Two Check
LeetCode 231
18. Power of Two - Pattern
Repeated division by 2
19. Power of Two - Algorithm
Step by step approach
20. Power of Two - Implementation
In pseudocode
21. Power of Two - Walkthrough
Tracing an example
22. Lessons from Power of Two
summary
23. Problem - Last Digit
Using modulo 10
24. Last Digit - Insight
Remainder when dividing by 10
25. Extracting All Digits
Repeated modulo and division
26. Problem - Fizz Buzz
LeetCode 412
27. Fizz Buzz - Insight
Checking divisibility
28. Fizz Buzz - Implementation
In pseudocode
29. Lessons from Fizz Buzz
summary
30. Problem - Add Digits
LeetCode 258
31. Add Digits - Loop Approach
Straightforward method
32. Add Digits - Digital Root
Modulo 9 pattern
33. Add Digits - Implementation
In pseudocode
34. Lessons from Add Digits
summary
35. Common Modulo Patterns
Practical applications
36. When to Use Integer Division
Practical decision making
37. Avoiding Common Mistakes
Pitfalls to watch for
38. Quiz: Putting It Together
Knowledge check
39. Practice - Happy Number
LeetCode 202
40. Happy Number - Hint
Detecting cycles
41. Section Recap
What we learned