FastPrepCount Ordered Combination Sums
Problems/Count Ordered Combination Sums

Count Ordered Combination Sums

Pinterest logoPinterest● MediumFULLTIMEPHONE SCREEN

Updated Aug 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report names the standard ordered combination-sum counting task but does not restate its reuse rules, bounds, or result-range guarantee. This practice version supplies the conventional positive-candidate contract.

Given an array of distinct positive integers candidates and a positive integer target, return the number of nonempty ordered sequences whose values sum to target.

  • You may reuse a candidate any number of times.
  • Two sequences with the same values in different orders count separately.

Function

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

Examples

Example 1

candidates = [1,2,3]target = 4return = 7

The sequences are [1,1,1,1], [1,1,2], [1,2,1], [2,1,1], [2,2], [1,3], and [3,1].

Example 2

candidates = [2,4]target = 6return = 3

The valid ordered sequences are [2,2,2], [2,4], and [4,2].

Example 3

candidates = [5]target = 3return = 0

No sequence of reusable 5s can sum to 3.

Constraints

  • 1 <= candidates.length <= 200.
  • 1 <= candidates[i] <= 1000.
  • All values in candidates are distinct.
  • 1 <= target <= 1000.
  • The correct answer fits a signed 32-bit integer.

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

  • Maximum Subarray Sum with One DeletionServiceNow · PHONE SCREENServiceNow interview questions
  • Maximum Product of a Contiguous SubarrayLinkedIn · PHONE SCREENLinkedIn interview questions
  • Fewest Coins CombinationBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Longest Increasing SubsequenceByteDance · PHONE SCREENByteDance interview questions
  • Jump GamePaytm · PHONE SCREENPaytm interview questions
  • Query Words Within K PositionsPalantir · PHONE SCREENPalantir interview questions
  • House RobberVisa · PHONE SCREENVisa interview questions
  • Best Improvement Period of at Least K IntervalsAmazon · PHONE SCREEN
  • Longest Increasing SubsequenceAngel One · PHONE SCREEN
  • Match Shops and BuyersGoogle · PHONE SCREENGoogle interview questions

Pinterest interview experiences

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