MCPcopy Create free account
hub / github.com/Blankj/awesome-java-leetcode / Solution

Class Solution

src/com/blankj/easy/_0069/Solution.java:11–24  ·  view source on GitHub ↗

author: Blankj blog : http://blankj.com time : 2017/05/08 desc :

Source from the content-addressed store, hash-verified

9 * </pre>
10 */
11public class Solution {
12 public int mySqrt(int x) {
13 long n = x;
14 while (n * n > x) {
15 n = (n + x / n) >> 1;
16 }
17 return (int) n;
18 }
19
20 public static void main(String[] args) {
21 Solution solution = new Solution();
22 System.out.println(solution.mySqrt(10));
23 }
24}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected