FastPrepCombination Sum with Single-Use Values
Problems/Combination Sum with Single-Use Values

Combination Sum with Single-Use Values

Pinterest logoPinterest● MediumFULLTIMEPHONE SCREEN

Updated Aug 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report names the standard single-use combination-sum task but does not restate its duplicate handling, ordering, or bounds. This practice version uses the conventional sorted backtracking contract.

Given an array of positive integers candidates and a positive integer target, return every distinct combination whose values sum to target.

  • Each array position may be selected at most once.
  • The input may contain duplicate values, but the result must not contain duplicate combinations.
  • Each combination must be nondecreasing, and the result must be in lexicographic order.

Function

combinationSumSingleUse(candidates: int[], target: int) → int[][]

Examples

Example 1

candidates = [10,1,2,7,6,1,5]target = 8return = [[1,1,6],[1,2,5],[1,7],[2,6]]

The two input occurrences of 1 may both be used, but identical value combinations appear only once.

Example 2

candidates = [2,5,2,1,2]target = 5return = [[1,2,2],[5]]

Although 2 occurs three times, [1,2,2] is returned only once.

Example 3

candidates = [4,4,4]target = 8return = [[4,4]]

Any two input positions form the same value combination, so the result contains one row.

Constraints

  • 1 <= candidates.length <= 100.
  • 1 <= candidates[i] <= 50.
  • 1 <= target <= 30.

More Pinterest Phone Screen questions

  • Shortest Pin Path Through TopicsPHONE SCREEN · Seen Nov 2026
  • Top K Pins with Insert and QueryPHONE SCREEN · Seen Nov 2026
  • Pins Violation Log QueriesPHONE SCREEN · Seen Nov 2026
  • Sparse Matrix Addition and MultiplicationPHONE SCREEN · Seen Nov 2026
  • Minimum Bus Routes to a DestinationPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Delete and Compact a Forest SubtreePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Optimal Account BalancingPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Aggregate Matching IPv4 Addresses Across ResponsesPHONE SCREEN · Seen Oct 2026
  • Escape Room LeaderboardPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Shortest Way to Form a Target StringPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • PermutationsEPAM · PHONE SCREENEPAM interview questions
  • Combination Sum with Unlimited ReuseNVIDIA · PHONE SCREENNVIDIA interview questions
  • Sort by Checking PermutationsMercor · PHONE SCREENMercor interview questions
  • Generate All Permutations of a NumberFleetx · ONSITE INTERVIEW
  • Bounded Combination Sum with Signed CandidatesConfluent · ONSITE INTERVIEWConfluent interview questions
  • Enumerate Character Paths to a MarkerTesla · ONSITE INTERVIEWTesla interview questions
  • Subsets IIBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Generate Circular Student ArrangementsAmazon · ONSITE INTERVIEW
  • Enumerate Compatible Meeting SubsetsExpedia · ONSITE INTERVIEWExpedia interview questions
  • Enumerate Valid Clock TimesMicrosoft · OAMicrosoft interview questions

Pinterest interview experiences

  • Pinterest Experienced MLE Phone Screen: 1 Experience
All Pinterest interview questionsSee Pinterest hiring insights
Saved
class Solution {
    public int[][] combinationSumSingleUse(int[] candidates, int target) {
        // Write your code here.
    }
}
Checking account…