Flag Overdraft Days From an Unsorted Checking Ledger
Last updated: November 29, 2026
Quick Overview
Given an opening balance and an unsorted list of (day, amount) checking transactions, return the days whose end-of-day balance closes negative and the total overdraft fees, where a flat $34 fee is charged once per negative day and itself reduces the balance.
JPMorgan Chase
November 29, 20260
0
0 solved
Given an opening balance and an unsorted list of (day, amount) checking transactions, return the days whose end-of-day balance closes negative and the total overdraft fees, where a flat $34 fee is charged once per negative day and itself reduces the balance.
Chase consumer banking engineers own posting and fee logic for millions of checking accounts, and the campus Software Engineer Program opens with a timed HackerRank style assessment. This warm-up checks whether you aggregate by day before judging the balance, sort correctly, and handle the fee feeding back into the next day.
What the Interviewer Expects
- Groups transactions by day so intraday order does not matter
- Sorts the days before walking the balance forward
- Applies the fee after detecting a negative close and carries it forward
- Uses integer cents in production instead of floats
- States complexity and handles an empty ledger
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
- Chase posts credits before debits within a day. How does that change the result if you judged after each transaction instead?
- How would you add a cap of three overdraft fees per day or a $50 grace buffer?
- Transactions arrive as a stream over months. What state do you keep per account?
- How would you test this against the production fee engine?
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_balance and transactions, a list of (day, amount) where positive is a credit and negative a debit, in any order. A day is an overdraft day if the balance at end of day is below z...
High-Level Design
- Sum amounts per day in a dictionary, which makes intraday order irrelevant.
- Walk the days in sorted order, adding each day's net to the running balance.
- If the close is negative, record the d...