can not understand how to find index
Can not understand code of money change in alogorithm stl
@sethyamir5, read about lower bound function you’ll get it ( or first watch the lecture on lower bounds)
The lower_bound() method in C++ is used to return an iterator pointing to the first element in the range [first, last) which has a value not less than val. This means that the function returns the index of the next smallest number just greater than or equal to that number. If there are multiple values that are equal to val, lower_bound() returns the index of the first such value.
The elements in the range shall already be sorted or at least partitioned with respect to val.
here we needed for 25 so it returned 50 but we cannot take 50 so reduced 1 after recuding the base address
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.