[프로그래머스] L1 예산
[풀이]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
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++){
if(budget >= d[i]){
budget -= d[i];
answer++;
}
}
return answer;
}
}
|
cs |
'Problem Solving' 카테고리의 다른 글
[프로그래머스] L1 키패드 누르기 / 2020 카카오 인턴십 (Java) (0) | 2020.12.19 |
---|---|
[프로그래머스] L1 실패율 / 2019 카카오 블라인드 채용 (Java) (0) | 2020.12.19 |
[프로그래머스] L1 다트 게임 / 2018 카카오 블라인드 채용 (Java) (0) | 2020.12.19 |
[프로그래머스] L1 비밀지도 / 2018 카카오 블라인드 채용 (Java) (0) | 2020.12.19 |
[프로그래머스] L2 파일명 정렬 / 2018 카카오 블라인드 채용 (Java) (0) | 2020.12.19 |
댓글