2
* @param {number[]} nums3
* @param {number} target6
var search = function (nums, target) {7
const len = nums.length;8
if (len === 1 && nums[0] === target) return 0;9
const h = nums.findIndex(10
(val, i) => nums[i === 0 ? nums.length - 1 : i - 1] > val12
if (h !== 0) nums = nums.slice(h).concat(nums.slice(0, h));13
// console.log(h, nums)18
if (nums[lo] === target) return (lo + h) % len;19
if (nums[hi] === target) return (hi + h) % len;23
const i = Math.floor((lo + hi + 1) / 2);24
// console.log(lo, hi, i)26
if (val === target) return (i + h) % len;27
if (val > target) hi = i;