Created
July 7, 2016 14:10
-
-
Save Anderssorby/a9c040683d020d0f48d0a71d2a9e19fd 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
;; 4clojure problem #53 | |
(fn [s] (loop [longest [] r (sorted-set) [x n & xs :as l] s] | |
(cond | |
(nil? n) longest | |
(= n (inc x)) (recur (if (> (+ 2 (count r)) (count longest)) (vec (conj r x n)) longest) (conj r x n) (rest l)) | |
:else (recur longest (sorted-set) (rest l))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment