Kids With the Greatest Number of Candies LeetCode solution in Python
1class Solution:2def kidsWithCandies(self, candy, extra):3# create an array(res) with all values as True and it's lenght is same as candies4res = [True] * len(candy)5# iterate over the elements in the array candy6for i in range(len(candy)):7# if the no. of canides at curr position + extra is greater than or equal to the maximum of candies then continue8if (candy[i] + extra) >= max(candy):9continue10# if not11else:12# change the value of that position in res as false13res[i] = False14# return the res list15return res