Leetcode Sqrt(x)
2016-07-19 04:48
323 查看
Implement
Difficulty: Medium
public class Solution {
public int mySqrt(int x) {
if(x < 0) return -1;
if(x == 0) return 0;
int ans = (int)(Math.sqrt((double)(x)));
return ans;
}
}
int sqrt(int x).
Difficulty: Medium
public class Solution {
public int mySqrt(int x) {
if(x < 0) return -1;
if(x == 0) return 0;
int ans = (int)(Math.sqrt((double)(x)));
return ans;
}
}
相关文章推荐
- Leetcode Number of Digit One
- Leetcode Largest Number
- Leetcode Word Break II
- [leetcode] 118. Pascal's Triangle
- php判断是否为今天
- Codeforces Round #327 (Div. 2)
- 决策树算法(四)——选取最佳特征划分数据集
- 一键安装LAMP或LNMP
- [leetcode] 110. Balanced Binary Tree
- Leetcode 299. Bulls and Cows (Python)
- redhat7.2用户及用户组权限管理操作实例
- zabbix redis_low_level_discovery
- OSChina 周二乱弹 ——风流不需编码强,红袖无言意最长
- rename datafile 做了什么
- Leetcode 373. Find K Pairs with Smallest Sums(Python)
- [LeetCode] 66. Plus One
- CnCrypt代码 之 为磁盘设备分配和移除盘符
- HDU 2203 亲和串
- HDU 2087 KMP求匹配串的重复次数
- HDU 1711 KMP求匹配位置