Indian coin make change greedy

not understand int idx=upper_bound(coins,coins+n,money)-1-coins this logic
why subtract we coins can you give me example

hello @AjayRRJ
here we are finding upperbound of money ie an element in array( coins ) whose value is is just greater than money (note it is greater not greater than equal to).
and this -> upper_bound(coins,coins+n,money)-coins will give index of that element.
but what actually we want ? we want value which is either equal to money or less than that , thats is the reason we are subtracting -1 from that index.
the value we obtain at index upper_bound(coins,coins+n,money)-coins-1 will be either equal to money or less than that