Home » Interview Topics » Backtracking
Backtracking
Backtracking is a problem solving technique in which we explore/generate all the possible solutions present in the solution space and check whether they satisfy the given constraint. We do this by recursively trying out all the possibilities and “backtracking”, whenever required.
Backtracking is similar to writing a brute force solution and usually its time complexity is exponential or very large.
Since, a backtracking problem has unusually high time complexity, the constraints of a backtracking problem are very small.