58bc23516c | ||
---|---|---|
.. | ||
readme.md |
readme.md
Lösung: Map und Reduce
def char_count(array)
counts = array.map { |e| e.length }
counts.reduce(:+)
end
array = %w{ Free Kevin Mitnick }
puts char_count(array)