1431. Kids With the Greatest Number of Candies ¶ Time: Space: C++JavaPython 1 2 3 4 5 6 7 8 9 10 11 12class Solution { public: vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) { vector<bool> ans; const int maxCandy = ranges::max(candies); for (const int candy : candies) ans.push_back(candy + extraCandies >= maxCandy); return ans; } }; 1 2 3 4 5 6 7 8 9 10 11class Solution { public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) { List<Boolean> ans = new ArrayList<>(); final int maxCandy = Arrays.stream(candies).max().getAsInt(); for (final int candy : candies) ans.add(candy + extraCandies >= maxCandy); return ans; } } 1 2 3 4 5 6 7 8class Solution: def kidsWithCandies( self, candies: list[int], extraCandies: int, ) -> list[bool]: maxCandy = max(candies) return [candy + extraCandies >= maxCandy for candy in candies]