哈希表
声明一个哈希表或 Set 或 Map,缓存结果,再从 Set 或者 Map 中获取想要的结果
二分查找
const len = nums.length;let min = 0;let max = len - 1;let res = len;while(min <= max) {const middle = ((max - min) >> 1) + min;if (target <= nums[middle]) {res = middle;max = middle - 1;} else {min = middle + 1;}}return res;
