LeetCode: Kids With the Greatest Number of Candies

Determine which kids can have the greatest number of candies after receiving extra candies.

Posted on LeetCode Python

Solution

Runtime

0 ms | Beats 100.00%

class Solution:
def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]:
answer = []
most = max(*candies)
for i in range(len(candies)):
if candies[i] + extraCandies >= most:
answer.append(True)
else:
answer.append(False)
return answer