1431. Kids With the Greatest Number of Candies Posted on 2020-07-27 | Edited on 2021-01-22 | Views: LeetCode 1234567891011121314// Time: O(N)class Solution { public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) { int max=Integer.MIN_VALUE; for(int candy:candies) max=Math.max(candy,max); List<Boolean> res=new ArrayList<>(); for(int i=0;i<candies.length;i++){ candies[i]=max-candies[i]; if(candies[i]<=extraCandies) res.add(true); else res.add(false); } return res; }}