function reverseSubArray(arr, begin, end) {
  while (begin < end) {
    const tmp = arr[begin];
    arr[begin] = arr[end];
    arr[end] = tmp;
    ++begin;
    --end;
  }
}
@param {Array<*>} arr Array.
@param {number} begin Begin index.
@param {number} end End index.