Reddit Experience · Oct 2025

Change Machine Question - Best answer I ever seen from an interview

1 upvote 3 replies

Interview Experience

This is the answer of an interviewee from one of my colleague's interview, enjoy: def change (bills, coins, amount): from a in range(amount): billChange = max(bills) <= amount amountLeft = billchan

Full Details

This is the answer of an interviewee from one of my colleague's interview, enjoy: def change (bills, coins, amount): from a in range(amount): billChange = max(bills) <= amount amountLeft = billchange - amount coinChange = max(coins) <= amountLeft cointChange return billChange + coinChange

Free preview. Unlock all questions →