After using comparator he is still subtracting 1

I am not able to understand why he is subtracting 1 even after using comparator.
int lb=lower_bound(coins, coins+n, money, compare) - coins-1;
I am asking about this 1, which comparator gives element which is <=key then what is the need of doing this?

hi… so we are using this -1 because consider the case of 120… over there we get ans as 200 while we need 100… we use compare comparator to handle cases like of 100

But after reversing the comparison we should get 100.

just try doing by removing -1… also dry run on some sample test… u would get better insight

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.