Generate a Cent-Exact Fixed-Rate Mortgage Amortization Schedule
Last updated: November 29, 2026
Quick Overview
Given a principal, an annual interest rate and a term in months, produce the monthly schedule of payment, interest, principal and remaining balance for a fixed-rate mortgage. Every amount must be rounded to cents and the loan must end at exactly zero.
Valon
November 29, 20260
0
0 solved
Given a principal, an annual interest rate and a term in months, produce the monthly schedule of payment, interest, principal and remaining balance for a fixed-rate mortgage. Every amount must be rounded to cents and the loan must end at exactly zero.
A warm-up in the style of a Valon phone screen: amortization is the backbone of every loan record in ValonOS, and borrowers and investors see these numbers directly. The interviewer checks whether you avoid floats, apply rounding consistently and handle the final-payment true-up instead of leaving a stray cent of balance.
What the Interviewer Expects
- Derive the level payment formula P*r/(1-(1+r)^-n) and handle a zero rate
- Use Decimal or integer cents, never binary floats, for money
- Round interest each month with an explicit rounding mode
- Adjust the final payment so the balance lands at exactly zero
- Return a clear structure and test with a known case such as $200,000 at 6% for 30 years
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 biweekly payment plan?
- What changes if the borrower makes a $10,000 curtailment in month 24: recast or shorter term?
- How do you compute the schedule for an adjustable-rate loan when the rate resets?
- Why might your schedule differ by a cent from the note's stated payment, and who wins?
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 (e.g. 200000), annual rate (0.06), term (360). Output one row per month: number, payment, interest, principal, ending balance. Money is in dollars to two decimals. Interest is monthl...
High-Level Design
- Compute the monthly rate r = annual/12.
- Compute the level payment with the annuity formula and round it once to cents. That rounded figure is what the borrower is billed.
- Walk month by month:...