← ALL NOTES
Array

2210. Count Hills and Valleys in an Array

Given nums: a hill is an index whose value is greater than its nearest distinct neighbors on both sides; a valley is smaller. Equal adjacent values count as one point. Return the total count of hills…

Loading…