Skip to content

Instantly share code, notes, and snippets.

@seanhandley
Created November 15, 2015 11:42
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 seanhandley/e71e1f46a8574c581b37 to your computer and use it in GitHub Desktop.
Save seanhandley/e71e1f46a8574c581b37 to your computer and use it in GitHub Desktop.
Einstein 16: Permutation
def q(a)
a.permutation
end
q([1,2,3]).to_a # => [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment