in this problem when we applying lower_bound function instead of upperbound function .
there is TLE why it so ?
why we can not apply lower bound?
help
Indian change coin (greedy problem))
hello @divesh2000
lower bound will also work.
but we need to check whether we have do -1 in the current indec or not.
let say from lower bound we get index i .
now if a[i] > money then do i-- and then apply ur logic ( i guess u missed this i-- part in ur solution and because of that it is showing tle)
otherwise apply ur logic direclty.
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.