```
public static int sqrt(int x) {
if( x == 0 || x == 1){
return x;
}
long start = 0;
long end = x;
while ( end-start > 1){
long mid = (int)(end + start) / 2;
long s = mid * mid;
if(s == x){
return (int)mid;
}
else if(s > x){
end = mid;
}
else {
start = mid;
}
}
return (int)start;
}
```

Above is the working code snippet. I have questions as below. Thank you in advance for helping. ;-)

- While(end-start > 1) why we need 1 here? just because the return

signiture is int?- If we change while loop from while(end-start > 1) to while(end > start), we have to make end = mid-1; and start = mid + 1, correct?
- Why we cannot return end? or (int)(start+end)/2?? I saw almost 99% answer return to the left bound of binary search.