Post Payments Through a Fees, Interest, Principal Waterfall With Daily Accrual
Last updated: November 29, 2026
Quick Overview
Given a loan's opening principal, APR and start date, and a dated stream of fee assessments and customer payments, accrue simple interest daily between events and apply each payment to outstanding fees, then accrued interest, then principal, returning any overpayment as a refund.
OneMain Financial
November 29, 20260
0
0 solved
Given a loan's opening principal, APR and start date, and a dated stream of fee assessments and customer payments, accrue simple interest daily between events and apply each payment to outstanding fees, then accrued interest, then principal, returning any overpayment as a refund.
Personal loans at OneMain are simple-interest loans, so when a customer pays early or late changes how much of the payment reduces principal. This question in a backend screen checks that you can model a servicing ledger precisely: event ordering, daily accrual, a strict allocation order, and an auditable result per payment.
What the Interviewer Expects
- Accrue interest as balance * APR / 365 * days elapsed since the previous event
- Apply each payment in a fixed waterfall: fees, then interest, then principal
- Treat overpayment beyond the payoff amount as a refund, not negative principal
- Order same-day events deterministically (fees before payments, or state your rule)
- Return a per-payment ledger plus the ending balances so the result is auditable
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
- A payment is returned for insufficient funds two days later. How do you reverse it without replaying the whole history incorrectly?
- Some states cap late fees or require interest-first allocation. How would you make the waterfall configurable per state?
- How do you handle a leap year when the contract says actual/365?
- How would you compute a payoff quote good through a future date?
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: principal, APR, start date, and events (date, kind, amount) where kind is fee or payment. Interest accrues daily on outstanding principal only (no compounding). A payment pays fees first, then...
High-Level Design
Sort events by date, placing fees ahead of payments on the same day. Keep running buckets: principal, interest_due, fees_due, and the date of the last event. For each event, first accrue interest for ...
Submit Your Answer
OneMain Financial Software Engineer Interview Guide
Interview process, tips, and preparation timeline