Because I have tested my code locally, and it is correct.

```
/* The guess API is defined in the parent class GuessGame.
@param num, your guess
@return -1 if my number is lower, 1 if my number is higher, otherwise return 0
int guess(int num); */
class GuessGame {
public int guess(int num) {
if (num == g) {
return 0;
} else if (num > g) {
return 1;
} else {
return -1;
}
}
public GuessGame(int g) {
this.g = g;
}
int g;
}
public class Solution extends GuessGame {
public static void main(String[] args) {
Solution s = new Solution(3);
System.out.println(s.guessNumber(10));
}
public Solution(int g) {
super(g);
}
public int guessNumber(int n) {
return guessNumber(1, n);
}
private int guessNumber(int s, int e) {
if (s == e) {
return s;
}
int mid = s + (e - s) / 2;
int result = guess(mid);
if (result == 0) {
return mid;
} else if (result > 0) {
return guessNumber(s, mid);
} else {
return guessNumber(mid + 1, e);
}
}
}
```