Reconcile Bank Ledger Entries Against Card Processor Settlements
Last updated: November 29, 2026
Quick Overview
Given bank ledger entries and processor settlement records, each with an id, a reference, an amount in cents and a date, match each bank entry to at most one settlement with the same reference and amount within a 2-day window, and report the matched pairs plus the unmatched entries on each side.
Wells Fargo
November 29, 20260
0
0 solved
Given bank ledger entries and processor settlement records, each with an id, a reference, an amount in cents and a date, match each bank entry to at most one settlement with the same reference and amount within a 2-day window, and report the matched pairs plus the unmatched entries on each side.
Treasury and merchant services teams at Wells Fargo reconcile internal ledgers against external files every day, and breaks drive exception queues that operations staff work by hand. The interviewer checks hashing for grouping, one-to-one matching with duplicates, and clean handling of timing differences.
What the Interviewer Expects
- Group candidates by (reference, amount) with a hash map instead of an O(n*m) scan
- Enforce one-to-one matching so duplicate payments are not both matched to one settlement
- Choose the closest date within tolerance deterministically
- Use integer cents, never floats
- Return both sides' unmatched items for the exception queue
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Greedy nearest-date matching is not always globally optimal. When does it fail and how would you fix it?
- How would you support partial matches such as one settlement covering three ledger entries?
- The files are 50 million rows each. How would you run this in Spark?
- How do you make a rerun produce the same matches?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Match key is exact (reference, amount_cents). Dates may differ by settlement lag up to day_tol days. Each record is used at most once. Output: list of (bank_id, proc_id) pairs, unmatched bank ids, u...
High-Level Design
Build a dict from (reference, amount) to the processor rows with that key, sorted by date. Walk bank rows in date order; for each, pick the unused processor row with the smallest date gap inside toler...