프로그래머스 주식가격
[Programmers] 주식가격
[Programmers] 주식가격 🎈문제 https://programmers.co.kr/learn/courses/30/lessons/42584 💬설명 for문을 두번 돌면 되는 문제 처음부터 끝까지 돌면서 각각에 대해 뒤에 있는 price들을 체크해준다. 데이터 크기도 그렇게 크지 않고 O(nlogn)에 풀수 있어서 효율성도 통과했다. 스택으로 풀면 시간이 더 단축된다. (두번째 풀이) (약 100ms -> 약 20ms) 👩💻코드 def solution(prices): answer = [] for index, price in enumerate(prices): answer.append(0) for i in range(index + 1, len(prices)): answer[-1] += 1 if price..