<doocs>2366.Minimum Replacements to Sort the Array_1.py
def minimumReplacement( nums: List[int]) -> int:
    ans, n = 0, len(nums)
    mi = nums[-1]
    for i in range(n - 2, -1, -1):
        v = nums[i]
        if v <= mi:
            mi = v
            continue
        k = (v + mi - 1) // mi
        ans += k - 1
        mi = v // k
    return ans
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_4 , var_6 = 0 , len ( var_0 )
    var_8 = var_0 [ - 1 ]
    for var_11 in range ( var_6 - 2 , - 1 , - 1 ) :
        var_12 = var_0 [ var_11 ]
        if var_12 <= var_8 :
            var_8 = var_12
            continue
        var_13 = ( var_12 + var_8 - 1 ) // var_8
        var_4 += var_13 - 1
        var_8 = var_12 // var_13
    return var_4
