[leetcode刷题系列]Sqrt(x)
来源:互联网 发布:c语言游戏五子棋 编辑:程序博客网 时间:2024/05/17 04:57
二分就好了
class Solution {public: int sqrt(int x) { // Start typing your C/C++ solution below // DO NOT write int main() function if(x <= 0) return 0; long long low = 1, high = x, mid; while(low <= high){ mid = low + high >> 1; if(mid * mid > x) high = mid - 1; else low = mid + 1; } return low - 1; }};
- [leetcode刷题系列]Sqrt(x)
- 【Leetcode长征系列】Sqrt(x)
- 刷leetcode:Sqrt(x)
- LeetCode刷题笔录Sqrt(x)
- leetcode 刷题之路 25 Sqrt(x)
- 【小熊刷题】sqrt(x) <Leetcode 69 Java>
- 开始刷leetcode day10:Sqrt(x)
- leetcode 第69题 Sqrt(x)
- LeetCode 第 69 题 (Sqrt(x))
- LeetCode: Sqrt(x)
- LeetCode sqrt(x)
- [Leetcode] Sqrt(x)
- LeetCode :Sqrt(x)
- leetcode 53: Sqrt(x)
- [LeetCode] Sqrt(x)
- Leetcode 69 sqrt(x)
- [Leetcode] Sqrt(x)
- leetcode:Sqrt(x)
- 详谈wince电源管理
- 操作系统--不要站在别人的看法上看操作系统
- 透过表象看本质!?
- 图论专项shortest_paths:UVa 11280
- 关于python文件操作
- [leetcode刷题系列]Sqrt(x)
- cocos2d-x(一) win32交叉编译android项目经验
- 04-在线小词典案例
- Java动态调用对象的方法
- wince+s3c6410 SD卡启动
- 0807leetcode刷题总结
- 将博客搬至CSDN
- tomcat默认首页
- 写点什么呢