Build a Mortgage Amortization Schedule With Extra Monthly Payments
Last updated: November 29, 2026
Quick Overview
Given a loan principal, annual interest rate and term in years, compute the fixed monthly payment and the full amortization schedule. Support an optional extra principal payment each month and report how many months and how much interest it saves.
Zillow
November 29, 20260
0
0 solved
Given a loan principal, annual interest rate and term in years, compute the fixed monthly payment and the full amortization schedule. Support an optional extra principal payment each month and report how many months and how much interest it saves.
Zillow Home Loans and the mortgage and affordability calculators on every listing page depend on getting this arithmetic exactly right to the cent. The interviewer is checking money handling (no binary floats), the final-payment rounding fix, and a clean loop that stops when the balance hits zero.
What the Interviewer Expects
- Derive the annuity payment formula and handle a zero rate
- Use Decimal or integer cents, never float, for balances
- Round interest each month to cents and make the final payment absorb rounding drift
- Stop early when extra payments pay off the loan
- Report total interest and months saved
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would you add a one-time lump sum payment in a given month?
- How would you model an adjustable-rate loan that resets after year five?
- The calculator on the listing page must update as the user drags a slider. Where does this code run and how do you keep it fast?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Inputs: principal , annual rate, term in years, optional monthly extra. Outputs: the scheduled payment, each month's interest, principal, and remaining balance, plus total interest. Amounts are i...
High-Level Design
Monthly rate , . Payment , or when . Each month: interest is the balance times rounded to cents; p...