Money change problem

sir in code,why you have subtracted 1 in line 17…we have already used compare function.

@ashnagalhotra now it returns the iterator to the first number that is bigger than the given number, earlier it was returning the first number that was bigger or equal. But we want the numbers which are equal to be considered too, so we changed compare function and now equal numbers cannot be returned as false. The iterator still returns the next element so we have to subtract 1 to access the previous element.

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.