Created
June 25, 2019 13:11
-
-
Save joshrotenberg/25aebc2128f06fa76820e275301b695e 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
(def input [[1 2 3] [4 5 6] [9 8 9]]) | |
(defn diag-diff2 | |
[arr] | |
(->> arr | |
(map-indexed (fn [i e] [(nth e i) (nth e (- (count arr) i 1))])) | |
(reduce (fn [acc [x y]] [(+ (first acc) x) (+ (second acc) y)])) | |
(reduce -) | |
Math/abs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment