Backtracking is an algorithm for finding all solutions by exploring all potential candidates. If the solution candidate turns to be not a solution, the backtracking algorithm discards it by making some changes on the previous step and then try again.