99% || C++
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    int maximizeWin(vector<int>& A, int k) \n    {\n        int res = 0, n = A.size(), j = 0;\n        vector<int> dp(n + 1, 0);\n        for (int i = 0; i < n; ++i) \n        {\n            while (A[j] < A[i] - k)\n                ++j;\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++']