```
public int guessNumber(int n) {
return tryo(1, n);
}
public int tryo(int low, int high){
int ans = -1;
int mid = (low + high) / 2;
if(guess(mid) == 0) ans = mid;
if(guess(mid) == 1) ans = tryo(mid+1, high);
if(guess(mid) == -1) ans = tryo(low, mid-1);
return ans;
}
```