<doocs>2289.Steps to Make Array Non-decreasing_1.py
def totalSteps( nums: List[int]) -> int:
    stk = []
    ans, n = 0, len(nums)
    dp = [0] * n
    for i in range(n - 1, -1, -1):
        while stk and nums[i] > nums[stk[-1]]:
            dp[i] = max(dp[i] + 1, dp[stk.pop()])
        stk.append(i)
    return max(dp)
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_3 = [ ]
    var_5 , var_7 = 0 , len ( var_0 )
    var_8 = [ 0 ] * var_7
    for var_11 in range ( var_7 - 1 , - 1 , - 1 ) :
        while var_3 and var_0 [ var_11 ] > var_0 [ var_3 [ - 1 ] ] :
            var_8 [ var_11 ] = max ( var_8 [ var_11 ] + 1 , var_8 [ var_3.pop ( ) ] )
        var_3.append ( var_11 )
    return max ( var_8 )
