374.Guess Number Higher or Lower Posted on 2017-09-16 | In LeetCode Solution 1: accepted 1msThe most standard binary search. 12345678910111213141516171819202122232425public class Solution extends GuessGame { public int guessNumber(int n) { int lo = 1; int hi = n; while (lo + 1 < hi) { int mid = lo + (hi - lo) / 2; System.out.println(mid); if (guess(mid) > 0) { lo = mid; } else if (guess(mid) < 0) { hi = mid; } else { return mid; } } if (guess(lo) == 0) { return lo; } else if (guess(hi) == 0) { return hi; } else { return 0; } }}