Skip to content

Latest commit

 

History

History
74 lines (65 loc) · 11.6 KB

backtracking.md

File metadata and controls

74 lines (65 loc) · 11.6 KB

Backtracking LeetCode Problems

A collection of LeetCode problems solved using Backtracking pattern techniques, explanations, and complexity analysis.

Problems

Easy

# Problem Language Time Space Explanation
1863 Sum of All Subset XOR Totals C++ O(n) O(1) Explanation
1920 Build Array from Permutation C++ O(n) O(1) Explanation
2717 Semi-Ordered Permutation JavaScript O(n) O(1) Explanation

Medium

# Problem Language Time Space Explanation
17 Letter Combinations of a Phone Number JavaScript O(n) O(1) Explanation
22 Generate Parentheses C++, JavaScript, Python O(n) O(1) Explanation
31 Next Permutation JavaScript, Python O(n) O(1) Explanation
39 Combination Sum JavaScript, Python O(n) O(1) Explanation
40 Combination Sum II Python O(n) O(1) Explanation
46 Permutations JavaScript, Python O(n) O(1) Explanation
47 Permutations II Python O(n) O(1) Explanation
77 Combinations PHP, Python O(n) O(1) Explanation
78 Subsets JavaScript, PHP O(n) O(1) Explanation
90 Subsets II JavaScript O(n) O(1) Explanation
93 Restore IP Addresses JavaScript, Python O(n) O(1) Explanation
113 Path Sum II Python O(n) O(1) Explanation
216 Combination Sum III JavaScript O(n) O(1) Explanation
437 Path Sum III JavaScript O(n) O(1) Explanation
473 Matchsticks to Square JavaScript O(n) O(1) Explanation
526 Beautiful Arrangement JavaScript O(n) O(1) Explanation
567 Permutation in String C++ O(n) O(1) Explanation
784 Letter Case Permutation Python O(n) O(1) Explanation
1053 Previous Permutation With One Swap Python O(n) O(1) Explanation
1238 Circular Permutation in Binary Representation Python O(n) O(1) Explanation
1286 Iterator for Combination JavaScript O(n) O(1) Explanation
1409 Queries on a Permutation With Key JavaScript O(n) O(1) Explanation
1415 The k-th Lexicographical String of All Happy Strings of Length n Python O(n) O(1) Explanation
1589 Maximum Sum Obtained of Any Permutation JavaScript O(n) O(1) Explanation
1734 Decode XORed Permutation Python O(n) O(1) Explanation
1806 Minimum Number of Operations to Reinitialize a Permutation Python O(n) O(1) Explanation
2275 Largest Combination With Bitwise AND Greater Than Zero Python O(n) O(1) Explanation
2597 The Number of Beautiful Subsets JavaScript O(n) O(1) Explanation
2741 Special Permutations Python O(n) O(1) Explanation
3577 Count the Number of Computer Unlocking Permutations Python O(n) O(1) Explanation
3644 Maximum K to Sort a Permutation Python O(n) O(1) Explanation
3720 Lexicographically Smallest Permutation Greater Than Target C++ O(n) O(1) Explanation
3752 Lexicographically Smallest Negated Permutation that Sums to Target JavaScript O(n) O(1) Explanation
3848 Check Digitorial Permutation JavaScript O(n) O(1) Explanation
3942 Minimum Operations to Sort a Permutation JavaScript O(n) O(1) Explanation

Hard

# Problem Language Time Space Explanation
37 Sudoku Solver Python O(n) O(1) Explanation
51 N-Queens JavaScript, Python O(n) O(1) Explanation
52 N-Queens II Python O(n) O(1) Explanation
60 Permutation Sequence Python O(n) O(1) Explanation
126 Word Ladder II Python O(n) O(1) Explanation
301 Remove Invalid Parentheses Python O(n) O(1) Explanation
903 Valid Permutations for DI Sequence Python O(n) O(1) Explanation
2056 Number of Valid Move Combinations On Chessboard Python O(n) O(1) Explanation
3116 Kth Smallest Amount With Single Denomination Combination Java O(n) O(1) Explanation
3149 Find the Minimum Cost Array Permutation Python O(n) O(1) Explanation
3343 Count Number of Balanced Permutations JavaScript O(n) O(1) Explanation
3470 Permutations IV JavaScript O(n) O(1) Explanation
3486 Longest Special Path II JavaScript O(n) O(1) Explanation
3715 Sum of Perfect Square Ancestors JavaScript O(n) O(1) Explanation
3734 Lexicographically Smallest Palindromic Permutation Greater Than Target Java O(n) O(1) Explanation