摘要: https://leetcode-cn.com/problems/sqrtx/ 实现int sqrt(int x)函数,给定一个数字,求sqrt(x)并且保留整数部分。 二分查找,令l=1,h=x,判断l<=h,当跳出循环时,即sqrt(x)不为整数时,return h,因为跳出循环时l>h,本题要 阅读全文
posted @ 2019-09-22 20:25 星辰大海。 阅读(393) 评论(0) 推荐(0) 编辑