Backtracking Algorithms for Combination Sum and Palindrome Partitioning

Combination Sum (Problem 39) Given a distinct integer array candidates and a target value target, find all unique combinations in candidates where the numbers sum to target. Each number may be used repeatedly. The solution uses backtracking with these key components: Parameters: The recursive function tracks the current sum, path, and starting ...

Posted on Tue, 26 May 2026 18:10:30 +0000 by mfindlay

Backtracking for Combination Sum, Combination Sum II, and Palindrome Partitioning

39. Combination Sum Problem: https://leetcode.cn/problems/combination-sum/description/ Find all unique combinations of candidates where the chosen numbers sum to target. The same number may be used a unlimited number of times. class Solution { public: vector<vector<int>> combinationSum(vector<int>& candidates, int targ ...

Posted on Sun, 10 May 2026 15:26:59 +0000 by Jedi Legend