
-Code
class Solution {
public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
List<Boolean> answer = new ArrayList<>();
int maxCnt = Integer.MIN_VALUE;
for (int candy : candies)
maxCnt = Math.max(maxCnt, candy);
for (int candy : candies) {
answer.add(candy + extraCandies >= maxCnt);
}
return answer;
}
}'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [LeetCode/Java] Reverse Vowels of a String (0) | 2025.12.19 |
|---|---|
| [LeetCode/Java] Can Place Flowers (0) | 2025.12.19 |
| [LeetCode/Java] Greatest Common Divisor of Strings (0) | 2025.12.19 |
| [LeetCode/Java] Merge Strings Alternately (0) | 2025.12.19 |
| [백준/Java] 2446번 별 찍기 - 9 (0) | 2025.12.19 |