C++||DP||Sliding window approaches🔥🚀🔥✨💖
Code\n\nclass Solution {\npublic:\n    int maximizeWin(vector<int>& prizePositions, int k) {\n        int res =0;;\n        int n = prizePositions.size();\n    
# Code\n```\nclass Solution {\npublic:\n    int maximizeWin(vector<int>& prizePositions, int k) {\n        int res =0;;\n        int n = prizePositions.size();\n        int j=0;\n\n        vector<int>dp(n+1,0);\n        for(int i=0;i<n;i++){\n            while(prizePositions[j]<prizePositions[i]-k)\n                j++;\n            \n            dp[i+1] = max(dp[i],i-j+1);\n            res = max(res,i-j+1+dp[j]);\n        }\n        return res;\n    }\n};\n```
['C++']