Python Solution Using Binary Search
For More DSA concepts and problem solution subscribe my channel\nhttps://www.youtube.com/channel/UCPbJzXhXAPB3aQnrBcbnqgQ\n# Code\n\nfrom bisect import bisect_r
### For More DSA concepts and problem solution subscribe my channel\nhttps://www.youtube.com/channel/UCPbJzXhXAPB3aQnrBcbnqgQ\n# Code\n```\nfrom bisect import bisect_right,bisect_left\nclass Solution:\n    def maximizeWin(self, prizePositions: List[int], k: int) -> int:\n        ans=prv=0\n        for i,item in enumerate(prizePositions):\n            j1=bisect_left(prizePositions,item-k)\n            j2=bisect_right(prizePositions,item+k)\n            ans=max(ans,j2-j1,prv+j2-i)\n            prv=max(prv,i-j1+1)\n        return ans\n```
['Python3']