Code RoomProbability final score within target
HardPrep Room Coding #848

Probability final score within target

CodingAlgorithms & data structuresSenior–Staff~40 min

You start with 0 points. While your score is strictly less than 'stop', you draw a number uniformly from 1..maxPts and add it. You stop drawing once your score is >= stop. Return the probability that your final score is <= target, rounded to 6 decimals. 0 <= stop <= 1000, 1 <= maxPts <= 1000, 0 <= target <= 1000 (target may exceed stop). If stop==0 you draw nothing and final score is 0.

Implement
prob_at_most(stop: int, target: int, maxPts: int) → float
Examples
in[10,12,6]out0.728183
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 40 min
InputExpectedGot
[10,12,6]0.728183not run yetsample