2p+dp ^^
time: O(N); space: O(N)\n\nint maximizeWin(vector<int>& x, int k) \n{\n\tint out{}; \n\tfor(int i{}, j{}, d[100002]{}; i<size(x); )\n\t\tif(x[i]-x[j]<=k)\n\t\t\
**time: `O(N)`; space: `O(N)`**\n```\nint maximizeWin(vector<int>& x, int k) \n{\n\tint out{}; \n\tfor(int i{}, j{}, d[100002]{}; i<size(x); )\n\t\tif(x[i]-x[j]<=k)\n\t\t\t++i,\n\t\t\td[i] = max(d[i-1], i-j),\n            out  = max(out,    i-j+d[j]);\n\t\telse\n\t\t\t++j;\n\treturn out;         \n}\n```
['C', 'C++']