backtracking

Backtracking is a problem-solving algorithmic technique that involves finding a
solution incrementally by trying different options and undoing them if they
lead to a dead end. It is commonly used in situations where you need to explore
multiple possibilities to solve a problem, like searching for a path in a maze
or solving puzzles like Sudoku. When a dead end is reached, the
algorithm backtracks to the previous decision point and explores a different
path until a solution is found or all possibilities have been exhausted.

Lets Understand
N-Queens problem

The N-Queens problem involves placing N queens on an N×N chessboard so that
no two queens threaten each other. This means no two queens can
share the same row, column, or diagonal. The algorithm
to solve this problem is typically implemented using backtracking.