Created
November 6, 2014 16:50
-
-
Save jergason/8e21861ab232acd6909a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 products-of-ints [nums] | |
"Takes an array of integers and returns an array of integers where the | |
element at each index is the product of all the other elements except the | |
element at that index multiplied." | |
(let [product-of-every-num (reduce * nums)] | |
(map #(/ product-of-every-num %) nums))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment