I explained the trivial binary search on best price or the trees sold won't work because the value function doesn't continuous.
Imagine a linear line function that is increasing/decreasing, but a few values got drop to 0 because of some condition. Then it's impossible to binary search the normal way because it will make your left/right decision being wrong. (when the mid value is pointing to that 0 value, your code bugs)
I explained the trivial binary search on best price or the trees sold won't work because the value function doesn't continuous.
Imagine a linear line function that is increasing/decreasing, but a few values got drop to 0 because of some condition. Then it's impossible to binary search the normal way because it will make your left/right decision being wrong. (when the mid value is pointing to that 0 value, your code bugs)