Skip to main content
added 114 characters in body
Source Link
G B
  • 23.4k
  • 1
  • 24
  • 55

Ruby, 4444 41 bytes

crossed out 44 is still 44

->w,h{(1...w*h).map{|x|[x%w<1|x|[x,x+=x%w<1?x-w+1w:x,x+1]1]}} 

Try it online!Try it online!

1-based solution

Ruby, 44 bytes

->w,h{(1...w*h).map{|x|[x%w<1?x-w+1:x,x+1]}} 

Try it online!

1-based solution

Ruby, 44 41 bytes

crossed out 44 is still 44

->w,h{(1...w*h).map{|x|[x,x+=x%w<1?w:1]}} 

Try it online!

1-based solution

Source Link
G B
  • 23.4k
  • 1
  • 24
  • 55

Ruby, 44 bytes

->w,h{(1...w*h).map{|x|[x%w<1?x-w+1:x,x+1]}} 

Try it online!

1-based solution