-
Notifications
You must be signed in to change notification settings - Fork 2
guess
bradendubois edited this page Nov 24, 2021
·
12 revisions
ID: guess
Difficulty: 3.4
CPU Time: 1 second
Memory: 1024 MB
One can do a basic binary search to find the number, with lower and upper bounds of 1 and 1000 at first. Output upper + lower / 2 (the midpoint), and take in the response; if correct, exit, if "lower", change the upper bound to be the midpoint minus 1, if "higher", change the lower bound to be the midpoint plus 1.