fork download
  1. p h = "142324312431".split(//)
  2.  
  3. h = h.each_slice(4).map(&:sort).flatten
  4.  
  5. p h
  6.  
Success #stdin #stdout 0.01s 7420KB
stdin
Standard input is empty
stdout
["1", "4", "2", "3", "2", "4", "3", "1", "2", "4", "3", "1"]
["1", "2", "3", "4", "1", "2", "3", "4", "1", "2", "3", "4"]