<doocs>0845.Longest Mountain in Array_1.py
def longestMountain( arr: List[int]) -> int:
    left, right = 0, 1
    status = -1
    ans = 0
    while right < len(arr):
        if status == -1 or status == 1:
            if arr[right] == arr[right - 1]:
                status = -1
            if status == -1:
                if arr[right] > arr[right - 1]:
                    status = 1
                else:
                    left = right
            if status == 1 and arr[right] < arr[right - 1]:
                status = 2
        else:
            if arr[right] == arr[right - 1]:
                status = -1
                ans = max(ans, right - left)
                left = right
            elif arr[right] > arr[right - 1]:
                status = 1
                ans = max(ans, right - left)
                left = right - 1
        right += 1
    if status == 2:
        ans = max(right - left, ans)
    return ans
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_4 , var_6 = 0 , 1
    var_7 = - 1
    var_8 = 0
    while var_6 < len ( var_0 ) :
        if var_7 == - 1 or var_7 == 1 :
            if var_0 [ var_6 ] == var_0 [ var_6 - 1 ] :
                var_7 = - 1
            if var_7 == - 1 :
                if var_0 [ var_6 ] > var_0 [ var_6 - 1 ] :
                    var_7 = 1
                else :
                    var_4 = var_6
            if var_7 == 1 and var_0 [ var_6 ] < var_0 [ var_6 - 1 ] :
                var_7 = 2
        else :
            if var_0 [ var_6 ] == var_0 [ var_6 - 1 ] :
                var_7 = - 1
                var_8 = max ( var_8 , var_6 - var_4 )
                var_4 = var_6
            elif var_0 [ var_6 ] > var_0 [ var_6 - 1 ] :
                var_7 = 1
                var_8 = max ( var_8 , var_6 - var_4 )
                var_4 = var_6 - 1
        var_6 += 1
    if var_7 == 2 :
        var_8 = max ( var_6 - var_4 , var_8 )
    return var_8
