def solution(prices):
len_p=len(prices)
answer = [0]*len_p
for i in range(len_p):
tmp=prices[i+1:]
for j in tmp:
if prices[i]>j:
answer[i]+=1
break
else :
answer[i]+=1
return answer
def solution(prices):
len_pr=len(prices)
answer = []
for i in range(len_pr):
tmp=prices[i+1:]
cnt=0
for j in tmp:
cnt+=1
if prices[i]>j:
break
answer.append(cnt)
return answer
from collections import deque
def solution(prices):
prices = deque(prices)
answer = []
len_pr = len(prices)
while len_pr != 0:
tmp = prices.popleft()
len_pr -= 1
cnt = 0
for i in range(len_pr):
if tmp>prices[i]:
cnt+=1
break
cnt+= 1
answer.append(cnt)
return answer
from collections import deque
def solution(prices):
prices = deque(prices)
answer = []
len_pr = len(prices)
while len_pr != 0:
tmp = prices.popleft()
len_pr -= 1
cnt = 0
for i in range(len_pr):
if tmp>prices[i]:
cnt+=1
break
cnt+= 1
answer.append(cnt)
return answer
from collections import deque
def solution(prices):
prices = deque(prices)
answer = []
len_pr = len(prices)
while len_pr != 0:
tmp = prices.popleft()
len_pr -= 1
cnt = 0
for j in prices:
if tmp>j:
cnt+=1
break
cnt+= 1
answer.append(cnt)
return answer
from collections import deque
def solution(prices):
prices = deque(prices)
answer = []
len_pr = len(prices)
for i in range(len_pr):
#while len_pr != 0:
tmp = prices.popleft()
#len_pr -= 1
cnt = 0
for j in prices:
if tmp>j:
cnt+=1
break
cnt+= 1
answer.append(cnt)
return answer
'STUDY > Algorithm' 카테고리의 다른 글
[프로그래머스] LEVEL2 소수 찾기, python3,완전탐색 (0) | 2019.11.04 |
---|---|
[프로그래머스] LEVEL2 탑, python3, 스택/큐 (0) | 2019.10.29 |
[프로그래머스] LEVEL2 124 나라의 숫자,python3 (0) | 2019.10.28 |
[프로그래머스] LEVEL2 프린터, python3, 스택/큐 (0) | 2019.10.28 |
[프로그래머스] LEVEL2 쇠막대기, python3, 스택/큐 (0) | 2019.10.28 |