DEV Community

Discussion on: Daily Challenge #44 - Mexican Wave

Collapse
 
hanachin profile image
Seiei Miyagi

ruby <3

def wave(s)
  s.size.times.filter_map { |i| s[i] =~ /\S/ && s.dup.tap { @1[i] = @1[i].upcase } }
end

puts wave("hello world")