[프로그래머스] 주식가격


스택/큐 - 주식가격

사용 언어 : Python3

def solution(prices):
    answer = []
    while(prices) :
        count = 0
        select = prices.pop(0)
        if prices :
            forcount = 0
            for i in range(len(prices)):
                if prices[i] >= select :
                    forcount += 1
                    count += 1
                elif forcount == 0 & prices[i] < select :
                    count = 1
                    break
                elif forcount != 0 & prices[i] < select :
                    count += 1
                    break
        answer.append(count)       
    return answer


© 2020. by bs-derek