Easy and simple solution in JavaScript. Almost like editorial but in JS :)
Please upvote\n# Code\n\n/**\n * @param {number} n\n * @param {number} k\n * @param {number} maxPts\n * @return {number}\n */\n    function new21Game(n, k, maxP
# Please upvote\n# Code\n```\n/**\n * @param {number} n\n * @param {number} k\n * @param {number} maxPts\n * @return {number}\n */\n    function new21Game(n, k, maxPts) {\n        let dp = new Array(n+1);\n        dp[0] = 1;\n        s = k > 0 ? 1 : 0;\n        for (let i = 1; i <= n; i++) {\n            dp[i] = s / maxPts;\n            if (i < k) {\n                s += dp[i];\n            }\n            if (i - maxPts >= 0 && i - maxPts < k) {\n                s -= dp[i - maxPts];\n            }\n        }\n        let ans = 0;\n        for (let i = k; i <= n; i++) {\n            ans += dp[i];\n        }\n        return ans;\n    }\n```
['JavaScript']