摘要: Description 题目 Farmer John has built a new long barn, with N (2 ⇐ N ⇐ 100,000) stalls. The stalls are located along a straight line at positions x1,.. 阅读全文
posted @ 2020-07-29 22:43 飞翔的菜鸟123 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 二分查找 在闭区间查找[begin,end],注意对找不到的处理 int binary_find(vector<int>& nums, int target){ int l=0,r=nums.size()-1;//Notice while(l<r){ int mid=l+(r-l)>>1; if(n 阅读全文
posted @ 2020-07-29 22:43 飞翔的菜鸟123 阅读(134) 评论(0) 推荐(0) 编辑