Created
August 12, 2016 13:58
-
-
Save marctrem/d684ab9e8dd7c5fcfc50fceb5f8a57c8 to your computer and use it in GitHub Desktop.
Some easy test from Codility
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 solution [num] | |
(let [num (str num) | |
freq (frequencies num) | |
biggest (->> (map #(repeat (get freq (char (+ 48 %)) 0) %) (range 9 -1 -1)) | |
flatten | |
(clojure.string/join "") | |
read-string)] | |
(if (> biggest 100000000) -1 biggest))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment