Skip to content

Resource · Guide or article

Combination Sum Problem

Problem statement and backtracking idea for Combination Sum, where candidates may repeat and must add up to a target.

Reviewed

Open the original: Combination Sum Problem (opens the original site in a new tab)

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same repeated number may be chosen from candidates unlimited number of times. Since the problem is to get all the possible results, not the best or the number of result, thus we don’t need to consider DP (dynamic programming), backtracking approach using recursion is needed to handle it.

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Question list

What it covers

  • Problem rules: distinct positive candidates, unlimited reuse, no duplicate combinations.
  • Two worked inputs with full solution sets.
  • Why the README chooses recursion with backtracking over dynamic programming, plus a decision tree for candidates [2, 3] and target 6.

How to use it

PrepKit study advice, not a claim made by the source.

Solve it from the decision tree before reading any code, then explain how you avoid duplicate orderings.

Scope and limitations

Brief, and the problem itself comes from LeetCode, which is the only reference. No complexity analysis.

Access and format

Free English README on GitHub (trekhleb/javascript-algorithms, MIT license).

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88

Evidence behind this overview
  • src/algorithms/sets/combination-sum/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email