FastPrepPositive Subset Sum
Problems/Positive Subset Sum

Positive Subset Sum

Confluent logoConfluent● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand Confluent report calls this a new onsite question and links it to a known subset-sum problem with positive integers. First decide whether some subset reaches the target, then return the chosen values. Our version keeps the first part that was directly reported, the yes-or-no answer. Finding the actual subset is the follow-up, so that several valid subsets do not make the exact output arbitrary.

You are given an array nums of positive integers and a positive integer target. Return true when some subset of array positions sums exactly to target; otherwise return false.

Each array position may be selected at most once. Equal values at different positions are separate choices.

As an interview follow-up, explain how to reconstruct and return one concrete subset after determining that the target is reachable.

Function

canReachTarget(nums: int[], target: int) → boolean

Examples

Example 1

nums = [12,1,61,5,9,2]target = 24return = true

The positions containing 12, 9, 2, and 1 sum to 24.

Example 2

nums = [2,4,6]target = 5return = false

No subset of the three positive values sums to 5.

Example 3

nums = [5,5,11]target = 10return = true

The two occurrences of 5 occupy different positions and may both be selected.

Constraints

  • 1 <= nums.length <= 200.
  • 1 <= nums[i] <= 10000.
  • 1 <= target <= 20000.

More Confluent Onsite Interview questions

  • Implement tail -nPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Sudoku Board ValidationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Sudoku Puzzle SolverPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Sequential Phrase Search Across DocumentsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Bounded Combination Sum with Signed CandidatesONSITE INTERVIEW · Seen Oct 2026
  • Detect a Silent SensorONSITE INTERVIEW · Seen Sep 2026
  • Build an Inverted Document IndexONSITE INTERVIEW · Seen Sep 2026
  • Combination Sum with Unlimited ReuseONSITE INTERVIEW · Seen Sep 2026
  • Word Search Across DocumentsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Windowed Key-Value MapPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2025

Similar questions at other companies

  • Count Subsets With a Target SumSafe Security · ONSITE INTERVIEW
  • 0/1 Knapsack with Weight and Volume LimitsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Maximum Subarray Sum with One DeletionOracle · ONSITE INTERVIEWOracle interview questions
  • Best Time to Buy and Sell Stock IIKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Coin ChangeMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Maximum SubarrayUpstart · ONSITE INTERVIEWUpstart interview questions
  • Smallest Sufficient TeamExpedia · ONSITE INTERVIEWExpedia interview questions
  • Maximum Product SubarrayHartford Financial Services · ONSITE INTERVIEWHartford Financial Services interview questions
  • Word BreakMoveworks · ONSITE INTERVIEWMoveworks interview questions

Interview reports that mention this question

  • Confluent Coding and System Design Questions: 33 Questions

Confluent interview experiences

  • Confluent Older Concurrency Rounds: 12 Experiences (Part 2 of 2)
  • Confluent Concurrency Interviews: 28 Experiences (Part 1 of 2)
  • Confluent SWE OA, Coding and Design Interviews: 19 Experiences
  • Confluent File Manipulation Round (tail -n): 19 Experiences
All Confluent interview questionsSee Confluent hiring insights
Saved
class Solution {
    public boolean canReachTarget(int[] nums, int target) {
        // Write your code here.
    }
}
Checking account…