Number of Subarrays That Match a Pattern I

Given two 0-indexed integer arrays nums and pattern, where every value in pattern is -1, 0, or 1.

A subarray nums[i..i + m - 1] of length m matches a pattern of length m - 1 if, f...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: