데이터 엔지니어 이것저것

프로그래머스 - 주식가격 스택/큐 본문

기타/알고리즘

프로그래머스 - 주식가격 스택/큐

pastime 2020. 5. 5. 23:43
728x90

소스코드

#https://programmers.co.kr/learn/courses/30/lessons/42584

def solution(prices):
    answer = []

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

'기타 > 알고리즘' 카테고리의 다른 글

체육복 - python, 탐욕알고리즘  (0) 2020.07.21
전화번호 목록 (python)  (0) 2020.07.12
수박수박수박수박수? (java)  (0) 2020.05.17
문자열 내 p와 y의 개수 (java)  (0) 2020.05.12
기본적인 정렬방법 5가지  (0) 2020.05.07