题解 | #求平方根#
求平方根
https://www.nowcoder.com/practice/09fbfb16140b40499951f55113f2166c
import java.util.*;
public class Solution {
/**
*
* @param x int整型
* @return int整型
*/
public int sqrt (int x) {
// write code here
for (int i = 0; i < x; i++) {
if (i * i < x && (i + 1) * (i + 1) > x) return i;
if (i * i == x) return i;
}
return x;
}
}

科大讯飞公司氛围 456人发布