@ 4:48 the code shows that lb returns <=25 value(-1 index). But it’s returning 20 i.e. lb returns 50’s address. But how is it so as 50 is >25?
Didn't understand the code
@mitrapranav0027_5d705c8b616e0add
return a<=b in custom compare works like upper_bound(it returns the first value which is not less than or equal to searched value) so lower_bound function with this custom compare will give you value just greater than searched value and subtracting -1 will give you the correct denomination of that money that will be either less than or equals to searched money.
Ohh ok. So Instead of that Can I use upper bound as it would find the term greater than(>) ?
yeah you can use upper bound.
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.