Maximum Amount That Can Ripple Through a Trust Line Network

Last updated: November 29, 2026

Quick Overview

Accounts are connected by trust lines, each giving a directed capacity for how much of one issued currency can move from one account to its neighbour. Compute the largest amount a sender can deliver to a receiver by rippling through intermediaries, and how much flows on each line.

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

0

0

0 solved


Accounts are connected by trust lines, each giving a directed capacity for how much of one issued currency can move from one account to its neighbour. Compute the largest amount a sender can deliver to a receiver by rippling through intermediaries, and how much flows on each line.

Rippling, where an issued-currency payment moves balances along a chain of trust lines through gateways, is one of the XRP Ledger's defining features and the ancestor of its payment engine. The onsite interviewer for a core ledger or payments role wants you to recognise a max-flow problem, implement augmenting paths correctly with residual edges, and reason about why the real engine uses a different, quality-ordered strategy.

What the Interviewer Expects
  • Recognise the problem as single-source single-sink max flow
  • Explain residual capacity and why reverse edges are needed
  • Implement Edmonds-Karp (BFS augmenting paths) correctly
  • Report per-edge flows from a skew-symmetric flow map
  • State complexity and contrast with how a payment engine prefers cheapest liquidity first
Key Topics to Cover
Max Flow
Edmonds-Karp
Residual Graph
Trust Lines
BFS
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
  • Each line also charges a transfer fee; how does the problem become min-cost flow?
  • How would you guarantee the result uses at most a fixed number of paths?
  • What changes if a line's capacity in each direction depends on the current balance and both parties' limits?
  • Why might a real ledger deliberately not find the true maximum?
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

Input: list of (a, b, cap) meaning a can push up to cap units to b (on a real trust line this is the holder's limit minus current balance, and the reverse direction has its own capacity). Outp...

High-Level Design

This is max flow. Repeatedly find a path from source to sink in the residual graph with BFS, push the bottleneck amount, and update residuals. Residual capacity on (u, v) is cap[u,v] - flow[u,v]. ...


Submit Your Answer
Markdown supported

Related Questions