Oct-19-2022, 01:59 PM
Well, I thought the Brits had done away with 1p, but the Internet says:
Looks like a job for modulo! Find the biggest coin that dispenses the maximum amount of change, then work on the rest.
Someone sticks in a £5 note, but only spends £3.01, how to allocate the change?
And if some coins are already gone?
Quote:The following coins are legal tender in the UK: All regular circulation coins: 1p, 2p, 5p, 10p, 20p, 50p, £1 and £2 pieces;
Looks like a job for modulo! Find the biggest coin that dispenses the maximum amount of change, then work on the rest.
Someone sticks in a £5 note, but only spends £3.01, how to allocate the change?
And if some coins are already gone?