Javascript - DP
\nconst new21Game = (N, K, W) => {\n  if (K === 0 || N >= K + W) return 1;\n\n  let sum = 1;\n  let ans = 0;\n  const dp = [];\n  dp[0] = 1;\n\n  for (let i = 1
```\nconst new21Game = (N, K, W) => {\n  if (K === 0 || N >= K + W) return 1;\n\n  let sum = 1;\n  let ans = 0;\n  const dp = [];\n  dp[0] = 1;\n\n  for (let i = 1; i <= N; i++) {\n    dp[i] = sum / W;\n\n    if (i < K) {\n      sum = sum + dp[i];\n    } else {\n      ans = ans + dp[i];\n    }\n\n    if (i - W >= 0) {\n      sum = sum - dp[i - W];\n    }\n  }\n\n  return ans;\n};\n```
[]