package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/
 */
public class Problem1431 {
    public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1431 prob = new Problem1431();
        System.out.println(prob.kidsWithCandies(new int[]{2,3,5,1,3}, 3)); // [true,true,true,false,true]
        System.out.println(prob.kidsWithCandies(new int[]{4,2,1,1,2}, 1)); // [true,false,false,false,false]
        System.out.println(prob.kidsWithCandies(new int[]{12,1,12}, 10)); // [true,false,true]
    }
}

@@ -12,16 +12,44 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0A
 import j
@@ -63,16 +63,16 @@
 l.List;%0A
-
 %0A/**%0A * 
@@ -262,444 +262,298 @@
     
-// TODO%0A        return null;
+int maxCandy = 0;%0A        for (int candy : candies) %7B
 %0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1431 prob = new Problem1431();%0A        System.out.println(prob.kidsWithCandies(new int%5B%5D%7B2,3,5,1,3%7D, 3)); // %5Btrue,true,true,false,true%5D%0A        System.out.println(prob.kidsWithCandies(new int%5B%5D%7B4,2,1,1,2%7D, 1)); // %5Btrue,false,false,false,false%5D%0A        System.out.println(prob.kidsWithCandies(new int%5B%5D%7B12,1,12%7D, 10)); // %5Btrue,false,true%5D
+    maxCandy = Math.max(maxCandy, candy);%0A        %7D%0A        List%3CBoolean%3E answer = new ArrayList%3C%3E();%0A        for (int candy : candies) %7B%0A            answer.add(candy + extraCandies %3E= maxCandy);%0A        %7D%0A        return answer;
 %0A   

Solve problem 1431