Skip to content

Commit a652501

Browse files
authored
Create Solution.java
1 parent e8be55f commit a652501

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class Solution extends GuessGame {
2+
public int guessNumber(int n) {
3+
int l = 1, r = n;
4+
while (l < r) {
5+
int mid = l + r >>> 1;
6+
if (guess(mid) <= 0) r = mid;
7+
else l = mid + 1;
8+
}
9+
return r;
10+
}
11+
}

0 commit comments

Comments
 (0)