2
public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {4
new ArrayList<>(candies.length); // better practice since the length is known7
0]; // always good practice to start from known value or to check constraints, 0 or -18
for (int i = 1; i < candies.length; i++) {10
Math.max(theHighest, candies[i]); // returns the greatest value for us to compare later12
// Since we are comparing with greatest value, we can use math logic to subtract extraCandies14
// (candies[i]+extraCandies >= theHighest) or (candies[i] >= theHighest-extraCandies)15
int mathLogic = theHighest - extraCandies;16
for (int i = 0; i < candies.length; i++) {17
// logic: 6+5>=10 or 6 >=10-518
if (candies[i] >= mathLogic) {