@@ -0,0 +1,575 @@
+/**%0A * Implement int sqrt(int x).%0A * Compute and return the square root of x. %0A *%0A *Note: Need to decalre the i,j,mid as long in order to avoid overflow when compute square.%0A *%0A */%0Apublic class Sqrt %7B%0A  public int sqrt(int x) %7B%0A        long i = 0, j = x / 2 + 1;%0A        while (i %3C= j) %7B%0A            long mid = i + (j - i) / 2;%0A            long square = mid * mid;%0A            if (square == x) return (int)mid;%0A            if (square %3C x) %7B%0A                i = mid + 1;%0A            %7D else %7B%0A                j = mid - 1;%0A            %7D%0A        %7D%0A        return (int)j;%0A    %7D%0A%7D%0A

Implement int sqrt(int x)