pyPython Practice LabFrom first print to final round
TOPIC 13 OF 18

Recursion and Backtracking Python lessons

Base cases, call stacks, recursive structure, choice trees, pruning, and undoing choices safely.

12 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL LEARN

Core concepts

Compute factorial recursivelySum digits recursivelyCalculate integer power recursivelyFind GCD recursivelyBinary search recursivelyCheck a palindrome recursivelyGenerate all permutationsGenerate all subsets
REUSABLE THINKING

Problem-solving patterns

  • recursion · base case
  • recursion · digits
  • divide and conquer · power
  • Euclid · recursion
  • binary search · recursion
LESSON OUTCOME

What this topic builds

Learn the idea once, trace it through two verified cases, then explain why your approach works.

ORDERED LESSONS

All 12 lessons in this topic

Work from top to bottom to build each concept gradually.

  1. #110
    Compute factorial recursively

    Use recursion to calculate seven factorial.

    BeginnerPremium
  2. #111
    Sum digits recursively

    Calculate a simple digit checksum recursively.

    IntermediatePremium
  3. #112
    Calculate integer power recursively

    Compute a power using logarithmic recursion.

    IntermediatePremium
  4. #113
    Find GCD recursively

    Find the greatest common divisor of two related values.

    IntermediatePremium
  5. #114
    Binary search recursively

    Find the zero-based index of a target in a sorted catalog.

    AdvancedPremium
  6. #115
    Check a palindrome recursively

    Verify a word with one middle character.

    AdvancedPremium
  7. #116
    Generate all permutations

    List every ordering of three distinct task labels.

    AdvancedPremium
  8. #117
    Generate all subsets

    List every subset of three numbered features.

    Interview-LevelPremium
  9. #118
    Generate balanced parentheses

    Generate every valid expression containing three pairs.

    Interview-LevelPremium
  10. #119
    Count N-Queens solutions

    Count valid arrangements on a 4-by-4 chessboard.

    Interview-LevelPremium
  11. #120
    Sort with merge sort

    Apply a stable divide-and-conquer sort to mixed integers.

    Interview-LevelPremium
  12. #121
    Sort with quicksort

    Sort a general list using recursive partitioning.

    Interview-LevelPremium