프로그래머스/Level 2

스택/큐 - 주식가격

bright_code 2020. 10. 13. 15:06
728x90
반응형
def solution(prices):
    answer = [0]* len(prices)
    
    for i in range( len(prices)-1 ):
        cnt = 1
        for j in range( i+1, len(prices) ):
            if prices[i] > prices[j] : 
                answer[i] = j -i 
                break 
        
        if answer[i] == 0 : 
            answer[i] = len(prices) - i -1
            
    return answer

 

728x90
반응형