Kids With the Greatest Number of Candies
July 27, 2020
Kids With the Greatest Number of Candies
class Solution {
public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
List<Boolean> result = new ArrayList<>();
int max = Arrays.stream(candies).max().getAsInt();
for (int i : candies) {
if (i + extraCandies >= max) {
result.add(Boolean.TRUE);
} else {
result.add(Boolean.FALSE);
}
}
return result;
}
}