Boolean Logic

True/False, AND, OR, NOT, XOR, truth tables, logical equivalences, and De Morgan laws. The foundation of programming conditions.

40 lessons
141 min
Codeforces: 800-1200LeetCode: 1200-1500

Lessons

1. Intro

What boolean logic is and why it matters

2m

2. What Is Boolean Logic?

Core concept

4m

3. True and False in Code

Literal values

4m

4. Boolean Variables

Storing true/false

4m

5. The AND Operator

Both must be true

4m

6. AND Truth Table

All combinations

4m

7. The OR Operator

At least one true

4m

8. OR Truth Table

All combinations

4m

9. The NOT Operator

Flips the value

4m

10. NOT Truth Table

Simple flip

3m

11. Quiz: Basic Operators

Knowledge check

2m1 problems

12. Combining Operators

Complex expressions

4m

13. Operator Precedence

Order matters

4m

14. The XOR Operator

Exclusive OR

4m

15. XOR Truth Table

Different inputs

4m

16. Short-Circuit Evaluation

Skipping unnecessary work

4m

17. De Morgan's Laws

Negating complex expressions

4m

18. De Morgan's Laws - Example

Concrete application

4m

19. Quiz: De Morgan's Laws

Knowledge check

2m1 problems

20. Logical Equivalences

Rewriting expressions

4m

21. Problem - Valid Parentheses

LeetCode 20

2m1 problems

22. Valid Parentheses - The Idea

Stack matching

4m

23. Valid Parentheses - Implementation

The code

5m1 problems

24. Problem - Power of Two

LeetCode 231

2m1 problems

25. Power of Two - The Idea

Single bit set

4m

26. Power of Two - Implementation

The code

3m1 problems

27. Quiz: Bitwise and Boolean

Knowledge check

2m1 problems

28. Boolean Expressions in Conditionals

If statements

4m

29. Boolean Expressions in Loops

Loop conditions

4m

30. Problem - Find All Numbers Disappeared in an Array

LeetCode 448

2m1 problems

31. Find Disappeared - The Idea

In-place marking

5m

32. Find Disappeared - Implementation

The code

5m1 problems

33. Problem - Single Number

LeetCode 136

2m1 problems

34. Single Number - The Idea

XOR cancellation

4m

35. Single Number - Implementation

The code

4m1 problems

36. Quiz: XOR Properties

Knowledge check

2m1 problems

37. Boolean Algebra Laws

Transformation rules

4m

38. Absorption and Domination Laws

Simplification rules

4m

39. Common Boolean Logic Mistakes

What to avoid

4m

40. Section Recap

What we learned

2m

Ready to start learning?

Access all 40 lessons with interactive content and progress tracking.