Created
January 2, 2015 03:45
-
-
Save uday-rayala/9bf6ddf3c3c8ad130469 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn get-change [coins value] | |
(->> (tree-seq #(> value (reduce + %)) | |
#(map (fn [c] (sort (conj % c))) coins) | |
[]) | |
(filter #(= 10 (reduce + %))) | |
distinct)) | |
(get-change [1 2 3] 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment