Problem · Array
Match Subarray to Pattern
Learn this problemProblem statement
Note - Checkout the source image below for the original prompt :)
Imagine you're given a list of numbers and a special pattern that describes how these numbers should relate to each other in a sequence—whether they rise, fall, or stay the same. Your task is to find how many smaller sequences within the list match this pattern exactly. Even though you don't need to find the most efficient way, your solution should be good enough to handle a reasonable amount of work without slowing down too much.
Function
uberMathToPattern(numbers: int[], pattern: int[]) → intExamples
Example 1
numbers = [4, 1, 3, 4, 4, 5, 5, 1]pattern = [1, 0, -1]return = 1Note - Checkout the source image below for the original explanation :)
Constraints
🍅🍅