Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

The problem description, based on my understanding, means how much money you need to GUARANTEE a win base on Optimal Strategy (binary search)

How could you guarantee a win with $1 for n=2?

my answer output 2 for n=2 but the leetcode answer is 1

that is simple, you should pick the smaller one rather than bigger one firstly. In this case only two possible ints are 1 and 2, we should guess 1 first. so the max loss is $1

@kira4 thanks. this is clear for me now.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.