Skip to content

Instantly share code, notes, and snippets.

@iracooke
Created July 23, 2014 08:04
Show Gist options
  • Save iracooke/1227de13bd2978bb941c to your computer and use it in GitHub Desktop.
Save iracooke/1227de13bd2978bb941c to your computer and use it in GitHub Desktop.
Rosalind PERM
#!/usr/bin/env ruby
def permutation(p, m)
all_p = p.to_a.permutation.to_a
puts all_p.length
all_p.each { |perm| puts perm.join(" ") }
end
permutation(1..3, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment