Sir this is not generating correct output .
This code is however same as sir’s code.
please explain.
here I have just change the input.
Money change problem
bhaiya check kar liya, same problem hai
But bhaiya according to question array should be sorted, or wahi ham mai bhi kiye hai to ye work karna chahiye na
hi @ritikbunty2511_729d0258992e0982 tmne aise coins le rakha h ki 25 nai banegi yahan, ye technique bhaina ne batya hoga ki bas indian coin system me hoga kyuki indian coin system greedy algorithm k hisaab se hai. otherwise tmko dp laga kr dekhna hoga.
Greedy chose krne k chakkar me 4 choose ho raha, but dp se 3 hoga
bhaiya lower bound function mai compare ka role explain kar do, especially is problem ke liye
hi @divyanshinegi2003_987b3f0f92dd8c0c,
ower bound is itself a function it will use tat comparator to comapare the parameters u dont have to mention that, u r changing the behavior of the default lowerbound function usnig comparator
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.
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.