Search
⌘K

Leetcode 2210. Count Hills and Valleys in an Array

Count how many hills and valleys appear in an array, where a position (or contiguous block of equal values) is a hill if its value is greater than the nearest non-equal neighbors on both sides and a valley if it is smaller than those neighbors; positions with no non-equal neighbor on either side are ignored.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.