Return all combinations that sum to target
Company: Imc
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
Given an array of **distinct positive integers** `candidates` and an integer `target`, return **all unique combinations** of `candidates` where the chosen numbers sum to `target`.
Rules:
- You may use each candidate **an unlimited number of times**.
- Two combinations are considered the same if they contain the same multiset of numbers (order does **not** matter).
- Return the combinations in any order.
Example:
- `candidates = [2,3,6,7]`, `target = 7`
- Valid output: `[[2,2,3],[7]]`
Constraints (typical):
- `1 <= candidates.length <= 30`
- `1 <= candidates[i] <= 200`
- `1 <= target <= 500`
Quick Answer: This question evaluates combinatorial search and algorithmic problem-solving skills, focusing on recursion/backtracking, unbounded item usage, and enforcing uniqueness of combinations.