Find the First Day Each Checking Account Overdraws
Last updated: November 29, 2026
Quick Overview
Given opening balances and an unsorted list of (account, date, amount in cents) postings, return for every account the first date whose end-of-day balance is negative.
Bank of America
November 29, 20260
0
0 solved
Given opening balances and an unsorted list of (account, date, amount in cents) postings, return for every account the first date whose end-of-day balance is negative.
A phone screen problem tied to consumer deposits, where overdraft decisions and Balance Connect transfers are based on end-of-day posted balances. The interviewer checks grouping, sorting, integer money handling and whether you ask what 'end of day' means before coding.
What the Interviewer Expects
- Clarify that the rule is end-of-day balance, not intraday
- Group postings by account and date, net them per day
- Use integer cents, never floats
- Handle accounts with an opening balance but no postings
- State complexity and memory use
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 the answer change if the bank posted credits before debits within a day?
- How would you stream this if postings arrive in date order across millions of accounts?
- How would you also return the most negative balance reached?
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: opening maps account to cents; txns is a list of (account, ISO date, signed cents) in any order. For each account, apply each day's net postings in date order and report the first date who...
High-Level Design
Two passes. First, aggregate postings into account then date then net cents, so intraday ordering does not matter (the rule is end-of-day). Second, for each account walk its dates in sorted order with...