Guess Number Higher Or Lower

easy
1. We are playing the Guess Game. The game is as follows:
2. I pick a number from 1 to n. You have to guess which number I picked.
3. Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.
4. You call a pre-defined API int guess(int num), which returns 3 possible results:
   a) -1: The number I picked is lower than your guess (i.e. pick < num).
   b) 1: The number I picked is higher than your guess (i.e. pick > num).
   c). 0: The number I picked is equal to your guess (i.e. pick == num).
5. Return the number that I picked.

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1 <= n <= 231 - 1
1 <= pick <= n

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
10 6
Output
6
Previous
Finding Mk Average
Next
Kahn Algorithm

Related Questions