Recursion coding challenges

Practise recursion with 7 coding challenges, from easy to hard. Every challenge runs in your browser with instant tests, an AI review of your code and community solutions to compare.

Medium · 7

Skills you'll practise: Base casesAlpha-beta pruningComposite patternDivide and conquerFlood fillGame searchGame treesHalving the exponentMinimaxNested dataRecursive DFSString cleaning
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
226
Challenges
2
Solutions shared
3
Languages

All challenges

Search by topic, language, or difficulty.

7 challenges
Medium

Count Islands

Count groups of connected land cells in a grid.

You'll learn Flood fillRecursive DFS
BeginnerGridsLearning-pathRecursion
No solutions yet
Medium

Recursive Palindrome

Check a palindrome recursively, ignoring case and punctuation.

You'll learn Base casesString cleaning
BeginnerLearning-pathRecursionStrings
No solutions yet
Medium

Recursive Power

Compute a power recursively by halving the exponent.

You'll learn Halving the exponentDivide and conquer
BeginnerLearning-pathRecursion
No solutions yet
Medium

Flatten Arbitrarily Nested Lists (Recursion)

Practice recursion by flattening arbitrarily nested lists while skipping null entries.

You'll learn Base casesNested data
Data-structuresRecursion
No solutions yet
Medium

Alpha-Beta Pruning

Evaluate a game tree with minimax and alpha-beta pruning, and count how many leaves the search really looks at.

You'll learn Alpha-beta pruningGame search
RecursionTreesai
No solutions yet
Medium

Minimax Tic-Tac-Toe

Pick the perfect tic-tac-toe move by searching the whole game tree with minimax.

You'll learn MinimaxGame trees
Recursionai
No solutions yet
Medium

Composite Folder Sizes

Compute the total size of every folder in a tree where folders contain files and other folders.

You'll learn Composite patternTrees
Design patternsRecursionTrees
No solutions yet