Money change problem!

in the video why are hey substracting 1 in thelower_bound function cven after passing compare function as parameter

@Shubham_helloworld
If u observe that
if u just write
lower_bound(arr,arr+n,key,compare)
without -1 then giving a money value which exists in the array
would return a wrong value
it returns the next greater value in the array

hence the -1 is required so that even 120 and 100 would give us answer 100
in case -1 is not written then 100 would give answer 120 because of the comparator

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.