Intermediate Enumerables • Exercise 2/5

Group By

00:00
0
20 points

Instructions

Create a function group_by_length that takes an array of strings
and returns a hash where keys are string lengths and values are
arrays of strings with that length.

Use the group_by method:
```ruby
["a", "bb", "c"].group_by { |s| s.length }

=> {1 => ["a", "c"], 2 => ["bb"]}

Your Code

Results

Click "Run Tests" to see results