The reason to use long is that for large number such as 808201

the mid * mid will be out of Integer.MAX_VALUE range.

```
public class Solution {
public boolean isPerfectSquare(int num) {
long start = 1;
long end = num;
while (start < end) {
long mid = start + (end - start) / 2;
if (mid * mid == num) {
return true;
} else if (mid * mid < num) {
start = mid + 1;
} else {
end = mid;
}
}
return start * start == num;
}
}
```