Skip to content
Discussion options

You must be logged in to vote

We need to compute the probability that Alice has n or fewer points when she stops drawing numbers in the game described. The game involves Alice starting with 0 points and drawing numbers from the range [1, maxPts] until her total points reach or exceed k. The solution involves dynamic programming and a sliding window technique to efficiently compute the probabilities.

Approach

  1. Problem Analysis: Alice starts at 0 points and draws numbers from 1 to maxPts (each with equal probability) until her total points are at least k. We need to find the probability that her total points when she stops are n or fewer. The solution involves:

    • Dynamic Programming (DP): We use a DP array where dp[i] r…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Aug 17, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants