Programing/자료구조, Algorithm
programmers - 주식가격[level2] - python
12345678910111213def solution(prices): answer = [] for i in range(0, len(prices)-1): # (0,3) 0,1,2 for j in range(i+1, len(prices)): # 1,4 1,2,3 if prices[i] > prices[j]: answer.append(j-i) break if j == len(prices)-1: answer.append(j-i) answer.append(0) return answerColored by Color Scriptercs
2019. 1. 26. 02:47