python3 Solution
\n\nclass Solution:\n    def maximizeWin(self, prizePositions: List[int], k: int) -> int:\n        dp=[0]*(len(prizePositions)+1)\n        res=0\n        j=0\n 
\n```\nclass Solution:\n    def maximizeWin(self, prizePositions: List[int], k: int) -> int:\n        dp=[0]*(len(prizePositions)+1)\n        res=0\n        j=0\n        for i,a in enumerate(prizePositions):\n            while prizePositions[j]<prizePositions[i]-k:\n                j+=1\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        \n```
['Python', 'Python3']