DDSA Solutions

Backtracking

24 problems · 18 with full explanations

2 Easy10 Medium6 Hard
Backtracking explores all possible solutions by building candidates incrementally and abandoning ("pruning") branches that cannot lead to a valid result. It powers N-Queens, Sudoku solver, permutations, and subset generation. Prune early to reduce the effective search space.

How to practice

To practice Backtracking 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 backtracking 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 Backtracking problems