loading...

re: Daily Challenge #244 - Search for Letters VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Here is a Ruby solution def change(str) result = '0' * 26 str = str.downcase str.each_char do |char| result[(char.ord - 97)] = '1' if c...
 

Ruby can also multiply strings by numbers, which is a bit easier than joining an array:

'0' * 26
#=> "00000000000000000000000000"
 

Thanks Michael, I like that better.

code of conduct - report abuse