구명보트1 프로그래머스 level2 _ 구명보트 [Python] 나는 왜 틀렸는가? 내가 처음 작성한 코드는 다음과 같다. def solution(people, limit): print(people) people = sorted(people, reverse = True) answer = 0 save = [] visit = [] for i in range(len(people)): if people[i] not in save: if len(save) == len(people): break rest = limit - people[i] x = [i] y = [people[i]] for j in range(i+1,len(people)): if rest >= people[j] and j not in save: x = [i,j] y = [[people[i],people[j]]] .. 2023. 2. 24. 이전 1 다음