I had this as an interview question at Google, and I feel like I've seen something like this on Leetcode before, and was wondering if someone can point me to the question.
Essentially, you're given some array. Let's say they're only lower case chars for simplicity. You want to find the number of subarrays, not necessarily contiguous, that are equal to a given subarray.
So for example, let's say we have the arr = [a a a b b b c c c] and the given subarray is [a b c]. The solution would be 27 because there are 27 different ways you can form the [a b c] subarray. The order in which each character appears must be the same in the original array and in the subarray.
Another example: arr = [c b a] and given subarray is [a b c]. The answer would be 0.