I got a time exceed limit error with a binary search algorithm. I am pretty sure my running time is O(logn), and I can't understand why exceeding time limit.

and the result is:

```
Submission Result: Time Limit Exceeded More Details
Last executed input:
2126753390
1702766719
```

And here is the code:

```
public class Solution extends GuessGame {
public int guessNumber(int n) {
int low = 1;
int high= n;
int mid = (int)((long)low+(long)high)/2;
int gue = guess(mid);
while(gue!=0){
if(guess(mid)==-1){
high=mid-1;
mid = (int)((long)low+(long)high)/2;
gue = guess(mid);
}else{
low=mid+1;
mid = (int)((long)low+(long)high)/2;
gue = guess(mid);
}
}
return mid;
}
}
```

Thank you so much!