Compute Daily Round-Up Savings Transfers from Card Purchases
Last updated: November 29, 2026
Quick Overview
Given settled debit card purchases as (day, amount_cents), compute how many cents to sweep into savings each day by rounding every purchase up to the next whole dollar, with an optional boost multiplier and daily cap.
Onepay
November 29, 20260
0
0 solved
Given settled debit card purchases as (day, amount_cents), compute how many cents to sweep into savings each day by rounding every purchase up to the next whole dollar, with an optional boost multiplier and daily cap.
A warm-up in the style of a OnePay phone screen, built around a savings feature that turns everyday card spend into automatic transfers to a high-yield savings account. The interviewer checks integer money handling, clean aggregation, and whether you ask about refunds and caps before coding.
What the Interviewer Expects
- Work in integer cents, never floats
- Return 0 round-up for exact-dollar purchases, not 100
- Skip refunds and non-positive amounts with a stated reason
- Apply the multiplier before the daily cap
- Produce output in day order and omit zero transfers
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 handle a purchase refunded two days after its round-up was swept?
- What changes if round-ups accumulate and only transfer once they reach $5?
- How do you make the daily sweep job safe to re-run after a crash?
- Should pending authorizations earn round-ups, and why or why not?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input is a list of settled purchases (day, amount_cents). For each positive purchase the spare change is the distance to the next whole dollar, so 10.00 yields 0. Per day,...
High-Level Design
One pass to bucket spare change by day in a dictionary, then a second pass in sorted day order to apply the cap and drop zeros. Keeping the cap step separate makes it easy to change the policy later, ...