<doocs>1944.Number of Visible People in a Queue_1.py
def canSeePersonsCount( heights: List[int]) -> List[int]:
    n = len(heights)
    ans = [0] * n
    stack = list()
    
    for i in range(n - 1, -1, -1):
        while stack:
            ans[i] += 1
            if heights[i] > stack[-1]:
                stack.pop()
            else:
                break
        stack.append(heights[i])
    
    return ans
def sample_funcname ( var_0 : List [ int ] ) -> List [ int ] :
    var_4 = len ( var_0 )
    var_6 = [ 0 ] * var_4
    var_8 = list ( )
    for var_11 in range ( var_4 - 1 , - 1 , - 1 ) :
        while var_8 :
            var_6 [ var_11 ] += 1
            if var_0 [ var_11 ] > var_8 [ - 1 ] :
                var_8.pop ( )
            else :
                break
        var_8.append ( var_0 [ var_11 ] )
    return var_6
