레벨2 문제
def solution(prices):
answer = []
for i in range(len(prices)):
cnt = 0
for j in range(i, len(prices)-1):
if (prices[i] <= prices[j]):
cnt += 1
else:
break
answer.append(cnt)
return answer
큐 사용
from collections import deque
def solution(prices):
answer = []
prices = deque(prices)
while prices:
c = prices.popleft()
count = 0
for i in prices:
if c > i:
count += 1
break
count += 1
answer.append(count)
return answer