Indian money change

why are we subtracting 1 even after adding compare function to lower_bound. after adding the compare parameter it will return element <=168 . then why subtract 1

to access the value at index the value is actually at

with lower_bound - vec[0] u get index which is not 0 based

so access the value make it 0 based by subtracting 1 from it

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

But in Binary search lecture, we did not do -1 in the lower bound, but still it was 0 based.