Match General Ledger Cash Entries to Bank Statement Lines
Last updated: November 29, 2026
Quick Overview
Given ledger cash entries and bank statement lines, each with an id, a posting day and an amount in cents, match each ledger entry to at most one bank line with the same amount within a date tolerance, preferring the closest date. Return the matched pairs plus the unmatched items on each side.
PwC
November 29, 20260
0
0 solved
Given ledger cash entries and bank statement lines, each with an id, a posting day and an amount in cents, match each ledger entry to at most one bank line with the same amount within a date tolerance, preferring the closest date. Return the matched pairs plus the unmatched items on each side.
Bank reconciliation is one of the first things an audit analytics tool automates, so a short exercise like this fits an online assessment for engineers building PwC audit and finance tooling. The grader looks for clean grouping by amount, a deterministic tie-break, and awareness that money must be handled as integers.
What the Interviewer Expects
- Group bank lines by exact amount so each lookup is cheap
- Enforce the date tolerance and pick the closest unused bank line
- Break ties deterministically so the output is reproducible for an auditor
- Use integer cents rather than floats
- Report both unmatched ledger entries and unmatched bank lines
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
- The greedy choice can be globally suboptimal; how would you get a maximum matching?
- How would you support one ledger entry matching several bank lines that sum to it?
- What changes if amounts can differ by bank fees of a few cents?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs are two lists of (id, day, amount_cents). A match needs equal amounts and |bank_day - ledger_day| <= tolerance. Each bank line can be used once. Output: matched (ledger_id, bank_id) pairs...
High-Level Design
Index bank lines by amount into a dict of lists sorted by day. Process ledger entries in date order and, for each, scan only the bank lines with the same amount, choosing the unused candidate with the...