How to Count the Number of Items Filtered in a Ruby Array

0
340

In this guide we’ll walk through how to count the number of items filtered in a Ruby array.

Summary

Implement a method that counts all of the values in an array that over 10.

Exercise File

Code File

Exercise Description

Build out a method that counts the total number of array elements that are greater than 10.

Sample Input

[100, 2, 5, 10, 11]

Expected Output

2

Real World Usage

This is a common Ruby coding interview question since it focuses on how well you know how to work with collections in Ruby.

Solution

Can be found on the solutions branch on github.

LEAVE A REPLY

Please enter your comment!
Please enter your name here