Python Medium
\nclass Solution:\n    def maximizeWin(self, prizePositions: List[int], k: int) -> int:\n\n        N = len(prizePositions)\n\n        dp = [0] * (N + 1)\n\n    
```\nclass Solution:\n    def maximizeWin(self, prizePositions: List[int], k: int) -> int:\n\n        N = len(prizePositions)\n\n        dp = [0] * (N + 1)\n\n        l = 0\n\n        ans = 0\n\n        for r in range(N):\n\n            while prizePositions[l] + k < prizePositions[r]:\n                l += 1\n\n            dp[r + 1] = max(dp[r], r - l + 1)\n\n            ans = max(ans, dp[l] + r - l + 1)\n        \n\n        return ans\n```
['Python3']