Skip to content

Instantly share code, notes, and snippets.

@chron
Created October 21, 2013 03: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 chron/7078344 to your computer and use it in GitHub Desktop.
Save chron/7078344 to your computer and use it in GitHub Desktop.
N Doors, K Monkeys golf in ruby
gets;~/ /
n=$`.to_i
1.upto($'.to_i){|r|1.upto(r){|m|0.step(n,m){|v|$*[v]^=1}}}
$><<(1..n).select{|i|$*[i]}*' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment