Skip to content

Instantly share code, notes, and snippets.

@teamon
Created November 11, 2008 14:09
Show Gist options
  • Save teamon/23852 to your computer and use it in GitHub Desktop.
Save teamon/23852 to your computer and use it in GitHub Desktop.
@n, @k = 18, 6
def f(start, curr)
if curr.size == @k
puts curr.inspect
else
((start+1)..@n).each do |b|
f(b, curr + [b])
end
end
end
f(0, [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment