Reconcile Internal Ledger Against a Bank Statement
Last updated: November 29, 2026
Quick Overview
You have an internal ledger and a partner bank statement, each a list of transaction amounts in posting order. Match as many entries as possible while preserving order on both sides, and return the matched index pairs plus the unmatched entries on each side.
SoFi
November 29, 20260
0
0 solved
You have an internal ledger and a partner bank statement, each a list of transaction amounts in posting order. Match as many entries as possible while preserving order on both sides, and return the matched index pairs plus the unmatched entries on each side.
As a bank holding company, SoFi reconciles its internal ledgers against partner and Federal Reserve settlement files daily. This problem tests whether you recognize longest common subsequence, can reconstruct the alignment rather than just its length, and can explain why greedy matching fails.
What the Interviewer Expects
- Identifies the problem as LCS over two sequences
- Fills a DP table and reconstructs the actual pairs
- Explains why greedy first-match can produce fewer matches
- Reports unmatched indices on both sides for investigation
- Discusses O(nm) memory and when to window or hash first
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
- How would you reduce memory if each file has a million rows?
- How would you allow amounts that differ by a small fee to still match?
- What if order is only approximately preserved, within a one day window?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Two lists of integer cent amounts. A match pairs equal amounts and pairs cannot cross (if ledger i matches statement j, later ledger entries only match later statement entries). Maximize matches, retu...
High-Level Design
This is LCS. Let dp[i][j] be the maximum matches using ledger[i:] and statement[j:]. If the heads are equal, match them; otherwise skip one side and take the better result. Filling from the back...