공부기록/프로그래머스
[프로그래머스] 예산
메델
2023. 9. 21. 02:33
import java.util.*;
class Solution {
public int solution(int[] d, int budget) {
int answer = 0;
Arrays.sort(d);
for(int i=0; i<d.length; i++){
budget-=d[i];
if(budget<0){
break;
}
answer++;
}
return answer;
}
}