Skip to content

Instantly share code, notes, and snippets.

@mamboking
Created August 26, 2011 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamboking/1173307 to your computer and use it in GitHub Desktop.
Save mamboking/1173307 to your computer and use it in GitHub Desktop.
Reverse k nodes
;;Reverse k nodes
(def linked-list (java.util.LinkedList. [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]))
(defn reverse-sub-lists [l k]
(mapcat reverse (partition-all k l)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment