C++ | Sliding Window + Dynamic Programming
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```cpp []\nclass Solution {\npublic:\n    int maximizeWin(vector<int>& prizePositions, int k) {\n        int i=0;\n        int j=0;\n        int ans=0;\n        vector<int>dp(prizePositions.size()+1,0);\n        while(j<prizePositions.size())\n        {\n            while(prizePositions[j]-prizePositions[i]>k)\n            {\n                i++;\n            }\n            dp[j+1]=max(dp[j],j-i+1);\n            ans=max(ans,dp[i]+j-i+1);\n            j++;\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'Sliding Window', 'C++']