Cheapest Funds Settlement Route Under a Time Deadline

Last updated: November 29, 2026

Quick Overview

Funds can move between accounts and partner banks along directed rails, each with a fee and a settlement time in hours. Return the minimum total fee to move funds from source to destination with total time at most the deadline, or -1 if impossible.

Upstart
Coding & Algorithms
Software Engineer
Upstart
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Funds can move between accounts and partner banks along directed rails, each with a fee and a settlement time in hours. Return the minimum total fee to move funds from source to destination with total time at most the deadline, or -1 if impossible.

Upstart moves money between partner banks, investors and borrowers using ACH, same-day ACH and wires, which trade fee against speed. This onsite problem checks whether you see that plain Dijkstra on fee is wrong under a time constraint and can design a pruned search over (fee, time) states.

What the Interviewer Expects
  • Explain why single-criterion Dijkstra fails here
  • Search over states that carry both fee and elapsed time
  • Pop by fee and prune states dominated in time
  • Reject edges that break the deadline
  • Justify correctness and bound the work
Key Topics to Cover
shortest paths
constrained Dijkstra
weighted graphs
Pareto pruning
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 times are small integers, how would a DP over (node, time) compare?
  • Rails only operate during banking hours. How does the model change?
  • How would you return the actual route?
  • What if you also need the fastest route under a fee budget?
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

Directed graph with n nodes and edges (u, v, fee, hours), fees and hours non-negative, hours positive. Find the minimum fee path from src to dst whose total hours do not exceed the deadline....

High-Level Design

Plain Dijkstra on fee keeps one label per node and would discard a slightly more expensive but much faster path that is the only way to meet the deadline. Instead push states (fee, time, node) into a ...


Submit Your Answer
Markdown supported