DDSA Solutions

Recursion

12 problems · 10 with full explanations

4 Easy2 Medium4 Hard
Recursion solves a problem by calling itself with a smaller sub-problem. Every recursive solution needs: a base case (to stop) and a recursive case (to reduce). Stack space is O(depth). Convert deep recursion to iteration with an explicit stack when stack overflow is a concern.

How to practice

To practice Recursion problems effectively, start with the Easy problems listed below, trace through each solution on paper, then re-implement without looking. When you can recognise the recursion pattern within 30 seconds of reading a new problem, move on to Medium difficulty. Use the related topic pages and our study guide for a structured progression.

Open the full study guide →

Start here (Easy + explained)

All Recursion problems