본문 바로가기
python-algorithm

Leetcode 1431. Kids With the Greatest Number of Candies

by 무적김두칠 2021. 7. 13.

1
2
3
4
5
6
7
8
9
class Solution:
    def kidsWithCandies(self, candies: List[int], extraCandies: int-> List[bool]:
        listMax=max(candies)
        ans=[]
        for i in candies:
            if i+extraCandies>=listMax :
                ans.append(True)
            else: ans.append(False)
        return ans
cs
반응형

'python-algorithm' 카테고리의 다른 글

Leetcode 1512. Number of Good Pairs  (0) 2021.07.13
Leetcode 1470. Shuffle the Array  (0) 2021.07.13
Leetcode 9. Palindrome Number  (0) 2021.07.12
Leetcode 7. Reverse Integer  (0) 2021.07.12
Leetcode 1. Two Sum  (0) 2021.07.12

댓글