Skip to content

Commit fc32464

Browse files
committed
Time: 1 ms (96.11%), Space: 43.8 MB (77.73%) - LeetHub
1 parent a462b45 commit fc32464

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
class Solution {
2+
public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
3+
4+
List<Boolean> answer = new ArrayList<>();
5+
//제일 큰 값 찾기
6+
int greatest = 0;
7+
for(int c : candies) {
8+
if(c > greatest) {
9+
greatest = c;
10+
}
11+
}
12+
13+
for(int c : candies) {
14+
int s = c + extraCandies;
15+
if (s >= greatest) {
16+
answer.add(true);
17+
} else {
18+
answer.add(false);
19+
}
20+
}
21+
22+
return answer;
23+
24+
}
25+
}

0 commit comments

Comments
 (0)