Created
March 18, 2017 13:57
-
-
Save ygrenzinger/3a79a5001038438c6eea85f29d4b9442 to your computer and use it in GitHub Desktop.
Clojure best language to win Google Interview :)
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
;; https://leetcode.com/problems/invert-binary-tree/?tab=Description#/description | |
;; exemple of a graph [[[1] 2 [3]] 4 [[6] 7 [9]]] | |
(defn invert [tree] | |
(if (< (count tree) 2) | |
tree | |
[(invert (nth tree 2)) (nth tree 1) (invert (nth tree 0))])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment