Count Hills and Valleys in an Array Problem
Count Hills and Valleys in an Array Problem — ExecCode Easy DSA Practice
Solve the Count Hills and Valleys in an Array problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.
Description You are given a 0-indexed integer array nums. An index i is part of a hill in nums if the closest non-equal neighbors of i are smaller than nums[i]. Similarly, an index i is part of a valley in nums if the closest non-equal neighbors of i are larger than nums[i]. Adj…
Practice Count Hills and Valleys in an Array free on ExecCode. Browse more ExecCode DSA problems.