Exercise: Occurrences of a Subarray in an Array

Test your understanding of hashes and arrays by counting the occurrences of all elements of a subarray in an array.

Problem statement

In this challenge, you’ll be given an array @array of strings and a subarray @subarray of this array, and your task will be to calculate the frequencies of each element of the subarray in the array.

Sample input

Get hands-on with 1200+ tech skills courses.