Backtracking is an effective method for solving commonly asked programming interview algorithmic problems. Backtracking depth-searches for solutions and then backtracks to the most recent valid path as soon as an end node is reached (i.e., we can proceed no further). This method reduces the search space since any paths we know are invalid are eliminated from the solution space.
However, using backtracking requires the ability to test partial solutions — the method can’t find global optimum if there’s no progress indicator that the solution path we’re currently on leads to a solution or not. However, something like Sudoku can be solved with backtracking — it is clear immediately if the current solution path is invalid if, say, there are two of the same number in a row, column, or square.

#interview #programming #data-science #coding #strategy

Backtracking: How to Approach Search Programming Interview Questions
2.55 GEEK