C++ Easy Solution
Code\n\nclass Solution {\npublic:\n    int maximizeWin(vector<int>& prizePositions, int k) {\n        int n = prizePositions.size();\n        vector<int> pre(n,
# Code\n```\nclass Solution {\npublic:\n    int maximizeWin(vector<int>& prizePositions, int k) {\n        int n = prizePositions.size();\n        vector<int> pre(n, 0);\n\n        int j = 0;\n        int end = prizePositions[0] + k;\n        int count = 0;\n        int maxi = 0;\n\n        for (int i = 0; i < n; i++) {\n            int curr = prizePositions[i];\n            while (curr > end) {\n                end = prizePositions[++j] + k;\n                count--;\n            }\n            count++;\n            maxi = max(maxi, count);\n            pre[i] = maxi;\n        }\n\n        j = n - 1;\n        end = prizePositions[j] - k;\n        count = 0;\n        maxi = 0;\n        int ans = pre[n - 1];\n\n        for (int i = n - 1; i >= 0; i--) {\n            int curr = prizePositions[i];\n            while (curr < end) {\n                end = prizePositions[--j] - k;\n                count--;\n            }\n            count++;\n            ans = max(ans, pre[i] + maxi);\n            maxi = max(maxi, count);\n        }\n        return ans;\n    }\n};\n```
['Sliding Window', 'C++']