Recursion and backtracking basics
Data Structures · Engineering
Study notes
Solve a maze by backtracking: at each cell, try moving right; recurse. If the path hits a dead end, undo the move (backtrack) and try down. Mark visited cells to avoid loops. The recursion explores all paths but abandons failures early, which is why backtracking beats brute force.