Skip to content

Instantly share code, notes, and snippets.

@djui
Last active December 15, 2015 04:50
Show Gist options
  • Select an option

  • Save djui/5204511 to your computer and use it in GitHub Desktop.

Select an option

Save djui/5204511 to your computer and use it in GitHub Desktop.
#(second (reduce (fn [[t r] x]
(if (= (last t) (dec x))
[(conj t x) r]
(if (> (count t) (max 1 (count r)))
[[x] t]
[[x] r])))
[[] []] (conj % -1)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment