Money change problem

Why we did -1 in the main logic line when we have used comparator function definition ,that is -
int lb = lower_bound( coins,coins+n,money, compare)
-coins. -1;

this is because if you just use
lower_bound(coins,coins+n,money,compare)-coins;
it is always greater than money (we made it so by passing compare function)
hence we have to decrease 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.