Leetcode 1431. Kids With the Greatest Number of Candies
1 2 3 4 5 6 7 8 9 10 11 | /** * @param {number[]} candies * @param {number} extraCandies * @return {boolean[]} */ var kidsWithCandies = function(candies, extraCandies) { let max = candies.reduce(function(a, b) { return Math.max(a, b); }); return candies.map(x => x + extraCandies >= max) }; | cs |