LeetCode Daily Challenge-2210 Count Hills and Valleys in an Array(Easy, Two Pointers, O(n))
Problem Description
LeetCode 2210 asks us to count the number of hills and valleys in an array. A hill is an element that is strictly greater than its neighbors, while a valley is an element that is strictly smaller than its neighbors. The key challe...
huanganni.hashnode.dev4 min read