FastPrepReach Target Balance
Problems/Reach Target Balance

Reach Target Balance

Confluent logoConfluent● MediumFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

Given a list of numbers, each representing a bank account transaction (positive for credit, negative for debit), determine if there exists a subset of transactions that sums exactly to a given target balance.

Return 1 if such a subset exists, 0 otherwise.

Follow-up: Start with the O(2^n) subset enumeration approach, then optimize toward a dynamic programming solution. Be prepared to discuss the upper bound on n for which each approach is practical (e.g. the O(2^n) solution is feasible up to roughly n ≈ 25).

Function

canReachBalance(transactions: int[], target: int) → int

Examples

Example 1

transactions = [1,2,3]target = 5return = 1

The subset {2, 3} sums to 5. Return 1 (true).

Example 2

transactions = [1,2]target = 4return = 0

Possible subsets and their sums: {} = 0, {1} = 1, {2} = 2, {1,2} = 3. None equal 4. Return 0 (false).

More Confluent interview questions

  • Hard Disk Clustering CostOA · Seen Nov 2026
  • Last Object to Fall Off the TableOA · Seen Nov 2026
  • Sum Symmetric Pairwise RemaindersOA · Seen Nov 2026
  • 0/1 KnapsackOA · Seen Nov 2026
  • 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
  • Count Combinations Using Weights One Through KOA · Seen Oct 2026
  • Match a Variadic Function SignaturePHONE SCREEN · Seen Oct 2026
  • Sequential Phrase Search Across DocumentsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Card Game: Best First-Player ScoreShopify · OAShopify interview questions
  • Maximum Game Score with Fixed Forward JumpsStripe · OAStripe interview questions
  • Minimum Cost to Tile a Strip with Widths 1, 2, and 3Infosys · OAInfosys interview questions
  • Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
  • Maximum Subarray SumStraive · OA
  • Longest Increasing Price SubsequenceOpenAI · OAOpenAI interview questions
  • Lowest-Cost Shirt Color ScheduleElevenLabs · OAElevenLabs interview questions
  • Maximum Game Board ScoreJP Morgan Chase · OAJP Morgan Chase interview questions
  • API Bandwidth AllocationArista Networks · OAArista Networks interview questions
  • Maximum Points by Deleting ElementsIBM · OAIBM interview 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
  • Confluent Coding and System Design Questions: 33 Questions
All Confluent interview questionsSee Confluent hiring insights
Saved
class Solution {
    public int canReachBalance(int[] transactions, int target) {
      // write your code here
    }

}
Checking account…