Skip to content

Instantly share code, notes, and snippets.

@minitech
Last active December 21, 2015 16:29
Show Gist options
  • Save minitech/6334130 to your computer and use it in GitHub Desktop.
Save minitech/6334130 to your computer and use it in GitHub Desktop.
i=gets.split
s=i[0].to_i
(i[1]<?3?s.downto(1):1..s).map{|x|t=?x*x
puts /2|4/=~i[1]?t.rjust(s):t}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment