力扣------二分查找

二分的流程: 1.肯定二分的邊界 2.編寫二分的代碼框架 3.設計一個check(性質) 4.判斷一下區間如何更新 5.若是更新方式時l=mid,r=mid+1,那麼在算mid的時候加1ios 69.x的平方根 #include<iostream> using namespace std; int mySqrt(int x) { int l = 0,r = x; while(l<r) {
相關文章
相關標籤/搜索