What is the time complexity of backtracking?

Updated Apr 28, 2026

Short answer

Usually exponential (O(2^n), O(n!)).

Deep explanation

Backtracking explores all possible combinations, leading to exponential time complexity depending on the problem.

Real-world example

Generating all permutations.

Common mistakes

  • Assuming it is efficient for large inputs.

Follow-up questions

  • Why exponential?
  • Can optimize?

More Backtracking interview questions

View all →