C++||DP||Sliding window || Beats 100%||Most Optimized
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    double new21Game(int n, int k, int maxPts) {\n        if(k==0 || n>=k+maxPts)return 1.0;\n\n        vector<double>dp(n+1);\n        dp[0]=1.0;\n\n        double currsum=1.0;\n        double ans=0.0;\n        for(int i=1;i<n+1;i++){\n            dp[i]=currsum/maxPts;\n             if(i<k){\n                 currsum += dp[i];\n             }else ans+= dp[i];\n\n             if(i>=maxPts){\n                 currsum-= dp[i-maxPts];\n             }\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'Sliding Window', 'C++']