Days Until a Strictly Lower Rate Quote Appears
Last updated: November 29, 2026
Quick Overview
Given a list of daily APR quotes for a loan product, return for each day how many days you would wait until a strictly lower quote appears, or 0 if no lower quote ever appears.
Upstart
November 29, 20260
0
0 solved
Given a list of daily APR quotes for a loan product, return for each day how many days you would wait until a strictly lower quote appears, or 0 if no lower quote ever appears.
Upstart's pricing moves with funding costs and model updates, and analysts like to know how long borrowers who waited would have needed to wait for a better rate. The assessment checks the monotonic stack pattern for next-smaller-element in linear time.
What the Interviewer Expects
- Recognize next smaller element
- Keep a stack of unresolved indices
- Pop while the current quote is strictly lower
- Record distances as indices are resolved
- Explain the amortized O(n) bound
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
- Return the lower rate itself rather than the wait.
- What if the quotes are a circular weekly pattern?
- How would you answer 'lower by at least 0.5 points' instead?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Strictly lower only, so equal quotes do not resolve each other. Output an integer list the same length as the input....
High-Level Design
Scan left to right with a stack of indices that have not yet seen a lower quote. Rates on the stack are non-decreasing from bottom to top. When a new quote is lower than the rate at the top, that top ...