Recursion and Backtracking Python lessons
Base cases, call stacks, recursive structure, choice trees, pruning, and undoing choices safely.
Core concepts
Problem-solving patterns
- recursion · base case
- recursion · digits
- divide and conquer · power
- Euclid · recursion
- binary search · recursion
What this topic builds
Learn the idea once, trace it through two verified cases, then explain why your approach works.
All 12 lessons in this topic
Work from top to bottom to build each concept gradually.
- #110Compute factorial recursivelyBeginnerPremium
Use recursion to calculate seven factorial.
- #111Sum digits recursivelyIntermediatePremium
Calculate a simple digit checksum recursively.
- #112Calculate integer power recursivelyIntermediatePremium
Compute a power using logarithmic recursion.
- #113Find GCD recursivelyIntermediatePremium
Find the greatest common divisor of two related values.
- #114Binary search recursivelyAdvancedPremium
Find the zero-based index of a target in a sorted catalog.
- #115Check a palindrome recursivelyAdvancedPremium
Verify a word with one middle character.
- #116Generate all permutationsAdvancedPremium
List every ordering of three distinct task labels.
- #117Generate all subsetsInterview-LevelPremium
List every subset of three numbered features.
- #118Generate balanced parenthesesInterview-LevelPremium
Generate every valid expression containing three pairs.
- #119Count N-Queens solutionsInterview-LevelPremium
Count valid arrangements on a 4-by-4 chessboard.
- #120Sort with merge sortInterview-LevelPremium
Apply a stable divide-and-conquer sort to mixed integers.
- #121Sort with quicksortInterview-LevelPremium
Sort a general list using recursive partitioning.