Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn make-change [amount]
- (loop [coins [100 50 25 10 5 1], change [], amount amount]
- (if (empty? coins)
- change
- (let [coin (first coins)]
- (if (< amount coin)
- (recur (rest coins) change amount)
- (recur coins (conj change coin) (- amount coin)))))))
Advertisement
Add Comment
Please, Sign In to add comment