cnadies중 max값을 찾아놓고 그것보다 큰지 작은지만 알아보면 된다.
class Solution {
public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
List<Boolean> answer = new ArrayList<>();
int max = Integer.MIN_VALUE;
for (int candy : candies) {
max = Math.max(max, candy);
}
for (int candy : candies) {
answer.add(candy + extraCandies >= max);
}
return answer;
}
}