Generate a Fixed-Rate Personal Loan Amortization Schedule in Cents
Last updated: November 29, 2026
Quick Overview
Given a principal in cents, an annual interest rate and a term in months, produce the monthly payment schedule (payment, interest, principal paid, remaining balance) with integer-cent rounding, making sure the final balance is exactly zero.
Upstart
November 29, 20260
0
0 solved
Given a principal in cents, an annual interest rate and a term in months, produce the monthly payment schedule (payment, interest, principal paid, remaining balance) with integer-cent rounding, making sure the final balance is exactly zero.
Upstart offers fixed-rate, fully amortizing personal loans with three and five year terms, so payment math appears across offer pages, servicing and investor reporting. The assessment checks the annuity formula, integer cent handling, and the final payment adjustment that absorbs rounding drift.
What the Interviewer Expects
- Use the annuity formula P r / (1 - (1+r)^-n)
- Keep money in integer cents
- Round interest each month consistently
- Adjust the final payment to zero out the balance
- Handle a zero interest rate
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 does an extra principal payment in month 6 change the remaining schedule?
- Why might the computed APR differ from the note rate when there is an origination fee?
- How would you test this against a partner bank's own schedule?
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 in cents, nominal annual rate (0.12 for 12%), term in months. Monthly rate r = annual / 12. Output one tuple per month. All money stays integer cents, and the last balance must be 0....
High-Level Design
Compute the level payment with the annuity formula and round to the cent. Each month, interest is the balance times r rounded to the cent, principal paid is payment minus interest, and the balance dro...