<doocs>2210.Count Hills and Valleys in an Array_1.py
def countHillValley( nums: List[int]) -> int:
    ans = j = 0
    for i in range(1, len(nums) - 1):
        if nums[i] == nums[i + 1]:
            continue
        if nums[i] > nums[j] and nums[i] > nums[i + 1]:
            ans += 1
        if nums[i] < nums[j] and nums[i] < nums[i + 1]:
            ans += 1
        j = i
    return ans
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_5 = var_3 = 0
    for var_9 in range ( 1 , len ( var_0 ) - 1 ) :
        if var_0 [ var_9 ] == var_0 [ var_9 + 1 ] :
            continue
        if var_0 [ var_9 ] > var_0 [ var_3 ] and var_0 [ var_9 ] > var_0 [ var_9 + 1 ] :
            var_5 += 1
        if var_0 [ var_9 ] < var_0 [ var_3 ] and var_0 [ var_9 ] < var_0 [ var_9 + 1 ] :
            var_5 += 1
        var_3 = var_9
    return var_5
