随笔分类 - 二分
摘要:在排序数组中查找数字 题目链接:https://leetcode-cn.com/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/ class Solution { public: int search(vector<int>& nums,
阅读全文
摘要:找精确值模板 int l = 0, r = n - 1; while(l <= r) { int mid = l + r >> 1; if(arr[mid] == target) return mid; else if(arr[mid] > target) r = mid - 1; else l =
阅读全文