주식 가격

이종호·2020년 9월 30일
0

알고리즘

목록 보기
7/18

코드

def solution(prices):
    answer = []
    for i in range(len(prices)-1):
        count = 0
        for j in range(i+1, len(prices)):
            count+=1
            if prices[i] > prices[j]:
                break            
        answer.append(count)
    answer.append(0)
    return answer

문제의 범위는 스택과 큐라고 하는데 나는 list만 써서 해결했다.
다른사람의 풀이도 비슷하므로 그냥 넘어가도 될 것 같다.

profile
열심히 사는 사람

0개의 댓글