Backtracking
LeetCode 216: Combination Sum III
·1 min
LeetCode
Medium
Array
Backtracking
LeetCode 216 note: use only 1 to 9, each at most once, choosing exactly k numbers that sum to n
LeetCode 93: Restore IP Addresses
·2 mins
LeetCode
Medium
String
Backtracking
LeetCode 93 note: cut into exactly 4 pieces, each 1 to 3 digits long, valued 0 to 255, with no leading zero except 0 itself
LeetCode 131: Palindrome Partitioning
·2 mins
LeetCode
Medium
String
Dynamic-Programming
Backtracking
LeetCode 131 note: each level cuts a palindrome from the front of the remaining string, trying every length from 1 to the whole remainder
LeetCode 90: Subsets II
·2 mins
LeetCode
Medium
Array
Backtracking
Bit-Manipulation
LeetCode 90 note: sort first; for a number equal to the previous one, extend only the subsets created in the previous step
LeetCode 79: Word Search
·3 mins
LeetCode
Medium
Array
String
Backtracking
Depth-First-Search
LeetCode 79 note: backtrack from every cell, matching the next character in four directions with visited cells marked temporarily and restored; prune early with character counts
LeetCode 78: Subsets
·1 min
LeetCode
Medium
Array
Backtracking
Bit-Manipulation
LeetCode 78 note: each element is either taken or not; iteratively, each new number copies every existing subset with the number appended
LeetCode 77: Combinations
·2 mins
LeetCode
Medium
Backtracking
LeetCode 77 note: choose k of 1 to n with dfs(start, path), picking the next only after start to avoid duplicate combinations
LeetCode 47: Permutations II
·2 mins
LeetCode
Medium
Array
Backtracking
Sorting
LeetCode 47 note: sort first, and within a level skip a value equal to the previous one when the previous one is unused
LeetCode 46: Permutations
·2 mins
LeetCode
Medium
Array
Backtracking
LeetCode 46 note: each level picks one unused number, marked in a used array, and records when the path is full
LeetCode 40: Combination Sum II
·2 mins
LeetCode
Medium
Array
Backtracking
LeetCode 40 note: each number is used once and duplicates exist, so sort, start the next level at i + 1, and skip equal values within a level
LeetCode 39: Combination Sum
·2 mins
LeetCode
Medium
Array
Backtracking
LeetCode 39 note: numbers may be reused, so the next level starts at i (not i + 1), which also avoids duplicates differing only in order
LeetCode 17: Letter Combinations of a Phone Number
·2 mins
LeetCode
Medium
Hash-Table
String
Backtracking
LeetCode 17 note: each level handles one digit and tries its letters; an empty input returns an empty list