Opening your learning path
Progress is saved as you study.
Opening your learning path
Progress is saved as you study.
The Backtracking Patterns pattern applies when you need subsets, permutations, combinations, N-Queens, and word search. Its time complexity is O(2ⁿ) or O(n!) depending on the branching and space complexity O(n) recursion depth. It is used in 24 problems on Thita, including Check if Word Can Be Placed In Crossword, Combinations and Combination Sum. Common variations are N-Queens / Constraint Satisfaction and Parentheses Generation.
Master backtracking algorithms including subsets, permutations, combinations, N-Queens, and word search. Exhaustive search with pruning for constraint satisfaction.
Backtracking Patterns is pattern 11 of 16 in the Thita.ai DSA course. It covers subsets, permutations, combinations, N-Queens, and word search, split into 7 subpatterns and about 3 hours of study. It is one of the interview-critical patterns, so it is worth covering before your first onsite.
Each subpattern below has its own theory page and problem set. They are listed in the order the course teaches them.
Read the theory for a subpattern, then solve its problems in the browser editor. Your solution runs against the problem's test cases, and the AI coach gives a hint on the technique you are missing rather than the finished answer. Progress is tracked per subpattern, so the tracker shows which of the 7 Backtracking Patterns subpatterns you have covered. Topics covered here include backtracking, backtracking algorithm, subsets generation, permutations, combinations, N-Queens, word search, constraint satisfaction.
24 problems, easiest first.
Fetching theory for Subsets (Include/Exclude)...