Money Change Problem Lecture

In the lower bound function we had already given a compare function (a <= b) then why there is the need for subtracting -1 after this ?

@vaishnavtannu yes thats an error in the video comparator a<=b just converts lower bound into upper bound (it dont give element less than the no so -1 is required )
hope its clear if yes dont forget to hit like and mark resolved :smiley:

But then why it’s showing correct output in video ?

@vaishnavtannu sir did not remove -1 so ans is showing less but if you do on your own and try using a<=b it will give the upperbound as result
ex
1 3 5 7
lower_bound without comp of 3 will be 3
lower_bound with comp of 3 will give 5