Number of Subarrays That Match a Pattern II
Turn adjacent differences into up, equal and down signs, then find every occurrence of the pattern in those signs with KMP.
Turn adjacent differences into up, equal and down signs, then find every occurrence of the pattern in those signs with KMP.