DSA Tutorial #15: Recursion and Backtracking — Think Before You Code
Recursion and backtracking are essential for solving problems where you need to explore all possibilities. Permutations, combinations, subsets, sudoku, and N-Queens all use backtracking. In this article, you will learn how recursion works, the backtracking template, and how to solve common interview problems. We show core examples in Kotlin, Python, and Go. What is Recursion? Recursion is when a function calls itself. Every recursive function has two parts: Base case: the condition that stops recursion Recursive case: the function calls itself with a smaller problem Python: ...