(Lv.01) 예산👾
https://school.programmers.co.kr/learn/courses/30/lessons/12982
단순히 비용이 적은 순서대로 정렬을 하고 총 비용에서 빼주면 가장 많은 부서를 지원할 수 있는 개수를 알 수 있다😊
def solution(d, budget):
d.sort()
count = 0
for i in d:
if budget >= i:
budget -= i
count += 1
else:
break
return count