Skip to content

Instantly share code, notes, and snippets.

@marctrem
Created August 12, 2016 13:58
Show Gist options
  • Save marctrem/d684ab9e8dd7c5fcfc50fceb5f8a57c8 to your computer and use it in GitHub Desktop.
Save marctrem/d684ab9e8dd7c5fcfc50fceb5f8a57c8 to your computer and use it in GitHub Desktop.
Some easy test from Codility
(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