Smallest Fixed Monthly Payment to Clear a Loan on Time
Last updated: November 29, 2026
Quick Overview
A loan has a principal in cents and a monthly interest rate in basis points; each month interest is added (rounded half up to the cent) and then the payment is applied. Find the smallest whole-cent fixed payment that brings the balance to zero within a given number of months.
SoFi
November 29, 20260
0
0 solved
A loan has a principal in cents and a monthly interest rate in basis points; each month interest is added (rounded half up to the cent) and then the payment is applied. Find the smallest whole-cent fixed payment that brings the balance to zero within a given number of months.
SoFi's personal and student loan refinance flows quote monthly payments, and engineers need to reason about rounding at the cent level rather than only the closed-form amortization formula. The interviewer checks binary search on the answer with a monotone feasibility check, and how you justify the search bounds.
What the Interviewer Expects
- Writes a feasibility simulation that applies interest then payment each month
- Argues monotonicity: a larger payment never takes longer to pay off
- Chooses a safe upper bound that clears the loan in month one
- Uses integer arithmetic for cents and basis points
- Compares against the closed-form amortization formula and explains the difference
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
- Why not just use the closed-form payment formula and round up?
- How would you handle a final payment that is smaller than the others?
- How would you find the minimum term in months for a member's maximum affordable payment?
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 (cents), rate_bp (monthly rate in basis points, 50 means 0.5%), months. Each month: balance += round_half_up(balance * rate), then subtract the payment (the last payment may ...
High-Level Design
The feasibility predicate pays_off(payment) is monotone: if payment p clears the loan, any p' > p leaves a balance no higher in every month, so it also clears. That lets us binary search on the paym...