Forwarded from Leetcode in Java && Oracle
#N1431 Kids With the Greatest Number of Candies
problem link=>https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/
problem link=>https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/
class Solution {
public List<Boolean> kidsWithCandies(int[] candies, int extra) {
ArrayList<Boolean> ans = new ArrayList<Boolean>();
int max=0;
for(int candy: candies){
max=Math.max(candy, max);
}
for(int candy: candies){
ans.add(candy+extra>=max);
}
return ans;
}
}