Skip to content

Instantly share code, notes, and snippets.

@ampersanda
Created November 9, 2019 04:43
Show Gist options
  • Save ampersanda/a58ca3bfcf0a7aadc2258cb64185caac to your computer and use it in GitHub Desktop.
Save ampersanda/a58ca3bfcf0a7aadc2258cb64185caac to your computer and use it in GitHub Desktop.
Code Signal - Decipher
(def decipher
(fn [e]
(loop [s e
r []]
(if (= (count s) 0)
(apply str (map #(char (read-string (apply str %)))r))
(let [l (if (= \1 (first s)) 3 2)
v (vec s)]
(recur (subvec v l)
(conj r (take l v))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment