I have two solutions, one is using "mid = start + (end - start) / 2;", passed; another is using "mid = (start + end) / 2;" timed out.

I really don't have clue what's going on.

Any suggestion is greatly helpful

public int firstBadVersion(int n) {

```
int start = 1;
int end = n;
while(start < end){
int mid = start + (end - start) / 2; //(start + end)/2;
if(isBadVersion(mid)){
end = mid;
}else{
start = mid + 1;
}
}
return start;
}
```