摘要:
题目描述 解法 思路:二分查找 class Solution { public: int searchInsert(vector<int>& nums, int target) { int left = 0, right = nums.size() - 1; int count = 0; if(nu 阅读全文
posted @ 2023-03-29 20:17
盏茶
阅读(13)
评论(0)
推荐(0)
摘要:
题目描述 解法 思路:二分查找 注意:当第一个 isBadVersion(mid)的结果为true时,得到第一个错误的版本 // The API isBadVersion is defined for you. // bool isBadVersion(int version); class Sol 阅读全文
posted @ 2023-03-29 19:57
盏茶
阅读(12)
评论(0)
推荐(0)
摘要:
题目描述 解法 class Solution { public: int search(vector<int>& nums, int target) { int left = 0; int right = nums.size()-1; while(left <= right){ int mid = 阅读全文
posted @ 2023-03-29 19:41
盏茶
阅读(13)
评论(0)
推荐(0)