Code Room
CodingHard
Question
You start with 0 points and keep drawing while your score is strictly less than k. Each draw adds a uniformly random integer from 1 to maxPts (inclusive) to your score. You stop as soon as your score is >= k. Return the probability that your final score is <= n, rounded to 5 decimal places. 0 <= k <= n <= 10^4, 1 <= maxPts <= 10^4.
Implement
new21_game(n: int, k: int, maxPts: int) → floatExamples
in
[10,1,10]out1What 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.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.