February 22 - Find the Largest Words in an Array in Ruby
Learn how to build a method that returns the largest words in an array in a Ruby program.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
  • Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license

Summary

Implement a method that finds the largest words in a Ruby array.

Exercise Description

Given a number and an array of strings, find the largest strings in an array.

Sample Input

Given an array of strings:

%w{a group of words that are variable length}

And a number of the largest items:

3

Expected Output

["variable", "length", "words"]

Real World Usage

This is a common skill when it comes to working with data collections. Additionally, if you follow a functional approach, you can learn how to leverage blocks to filter data.

Test Cases

Code File