[Python] Binary Search + DP
\n        def maximizeWin(self, arr: List[int], k: int) -> int:\n            n = len(arr)\n            best = [0]*(n+1)  # best segment after >= i \n           
\n        def maximizeWin(self, arr: List[int], k: int) -> int:\n            n = len(arr)\n            best = [0]*(n+1)  # best segment after >= i \n            res = 0\n            for i in range(n-1,-1,-1):   # curr seg start at ith\n                e = bisect.bisect_right(arr,arr[i]+k)   # take maximum as possible\n                res = max(res,e-i + best[e])  # maximize the segments , curr seg [i,e) + next segment after >= e\n                best[i] = max(best[i+1],e-i)  # track the best segment [i,e)\n            return res
['Dynamic Programming', 'Binary Tree']