Estimate Per-Session Patient Cost With Deductible and Coinsurance
Last updated: November 29, 2026
Quick Overview
Given a patient's plan (deductible, coinsurance rate, out-of-pocket maximum, and amounts already met) and a list of allowed amounts for upcoming therapy sessions in date order, return what the patient owes for each session.
Headway
November 29, 20260
0
0 solved
Given a patient's plan (deductible, coinsurance rate, out-of-pocket maximum, and amounts already met) and a list of allowed amounts for upcoming therapy sessions in date order, return what the patient owes for each session.
Headway shows patients an estimated cost before they book a therapist, and that estimate depends on where the patient sits on their deductible and out-of-pocket maximum. A phone screen version of this checks that a candidate can turn plan rules into clean, ordered state updates without off-by-one mistakes in the accumulators.
What the Interviewer Expects
- Process sessions strictly in date order and carry deductible and out-of-pocket state forward
- Apply the deductible portion before coinsurance within a single session
- Cap each session's responsibility at the remaining out-of-pocket amount
- Handle plans with a zero deductible or already-met accumulators
- Explain rounding choices for currency
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 a flat copay plan change the logic, and what if copays count toward the out-of-pocket max?
- How would you represent money to avoid floating point drift in production?
- What changes if a claim for an earlier session arrives after later ones were estimated?
- How would you show the patient a range rather than a point estimate when benefits data is uncertain?
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: sessions (allowed amount per session, in date order), deductible, coinsurance (fraction the patient pays after the deductible), oop_max, and amounts already met this plan year. Output:...
High-Level Design
Keep two running balances: deductible remaining and out-of-pocket remaining. For each session, the first dollars go to the deductible (patient pays 100%), the rest is split by coinsurance, and the tot...