/ Published in: Ruby
Cut down another 4 characters due to requirement dropping :
space ascii code is 32, b = 32/32 => 1 and that modulo 1 is zero.
It's just question of iterating through after that.
space ascii code is 32, b = 32/32 => 1 and that modulo 1 is zero.
It's just question of iterating through after that.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
s=' '.ord;a=s%b=s/s b.upto(s-b-b){|x|p "#{x} #{a=b+b=a}"}