Probability final score within target
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) → floatExamples
in
[10,12,6]out0.728183What 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
solution.py
InputExpectedGot
[10,12,6]0.728183not run yetsample