Graph explanation of how to calculate the index after reverse the subarray
A----------X------------|--------------Y-----------B\n\n\nSuppose the start index of subarray is A, current index of 1 is X and we know the subarry size is K, w
A----------X------------|--------------Y-----------B\n\n\nSuppose the start index of subarray is A, current index of 1 is X and we know the subarry size is K, what is Y?\n\nEasily we could got two formulas:\n```\nB - A + 1 = K\nX - A = B - Y\n```\nThus we could get\n```\nY = A + B - X\n```\n\nAnd we could plug in \n```\nB = K - 1 + A\n```\n\nFinally \n```\nY = A + (K - 1 + A) - X = 2*A + K - 1 - X\n```
['Graph']