My idea is, for any non-negative number N, sqrt(N) = 2/2*sqrt(N) =2*sqrt(1/4)*sqrt(N) = 2*sqrt(N/4). And for the Ns that are not multiple of 4, for example, 9, 25 or 49, the actual result should be 1+2*sqrt(N/4), because we need to take remainders into account.

```
public int mySqrt(int x) {
if(x < 4) return x == 0 ? 0 : 1;
int res = 2 * mySqrt(x/4);
if((res+1) * (res+1) <= x && (res+1) * (res+1) >= 0) return res+1;
return res;
}
```

Hope it helps.