Leetcode 40. Combination Sum II
Given a multiset of candidate numbers, return all unique combinations that sum to the target where each candidate may be used at most once. This requires exploring combinations (DFS/backtracking) while handling duplicate values (e.g., sort and skip repeats) to avoid duplicate result sets.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early August, 2026
// Given a list and a target number, return true if any combination of // addition and/or multiplication of the list numbers hits the target // Notes: // - You can ignore arithmetic order of operations // - Numbers must be used left to right and cannot reorder numbers in the list // Ex. // list = [2,3,5, 0], target = 25 -> true, because 2 + 3 * 5 = 25
Early June, 2026
Early October, 2025
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target. Each number in candidates may only be used once in the combination. Note: The solution set must not contain duplicate combinations. Write the test cases and everything.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.