Find All Loan Bundles Summing Exactly to a Buyer's Target

Last updated: November 29, 2026

Quick Overview

An institutional buyer wants a bundle of whole loans whose principals sum exactly to a target. Given a list of principals that may contain duplicates, return every unique combination (each loan used at most once) that hits the target.

Upstart
Coding & Algorithms
Software Engineer
Upstart
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


An institutional buyer wants a bundle of whole loans whose principals sum exactly to a target. Given a list of principals that may contain duplicates, return every unique combination (each loan used at most once) that hits the target.

Upstart sells loan pools to institutional investors, and ops engineers sometimes need to assemble bundles that meet a size requirement. The interviewer checks backtracking with pruning and correct deduplication when equal principals appear more than once.

What the Interviewer Expects
  • Sort to enable pruning and duplicate skipping
  • Backtrack with a start index so each loan is used once
  • Skip equal values at the same recursion depth
  • Break early once a value exceeds the remaining target
  • Explain the exponential worst case
Key Topics to Cover
backtracking
pruning
deduplication
combinations
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • If the buyer accepts anything within 1% of the target, how would you change the search?
  • There are 50,000 loans. Is enumeration still sensible? What would you do instead?
  • Add a constraint that average FICO in the bundle is at least 700.
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Principals are positive integers (dollars). Output combinations as sorted lists, and the overall list in lexicographic order. Two combinations with the same values are the same bundle even if they use...

High-Level Design

Sort the principals. Recurse with a start index and a remaining amount. At each depth, try each candidate from start onward, but skip a value equal to its predecessor at that same depth, because choos...


Submit Your Answer
Markdown supported