C++ EASY SOLUTION || DYNAMIC PROGRAMMING.
\n\n# Code\n\nclass Solution {\npublic:\n    double new21Game(int n, int k, int maxPts) {\n\n           if (k == 0 || n >= k + maxPts) {\n            return 1.0
\n\n# Code\n```\nclass Solution {\npublic:\n    double new21Game(int n, int k, int maxPts) {\n\n           if (k == 0 || n >= k + maxPts) {\n            return 1.0;\n        }\n        vector<double> dp(n + 1);\n        double currSum = 1.0;\n        double ans = 0.0;\n\n         dp[0] = 1.0;\n\n        for (int i = 1; i < n+1; i++) {\n\n            dp[i] = currSum / maxPts;\n\n            if (i < k) \n                currSum += dp[i];\n\n             else \n                ans += dp[i];\n            \n            if (i - maxPts >= 0) \n                currSum -= dp[i - maxPts];\n            \n        }\n\n        return ans;\n    }\n};\n```
['C++']