close
def kidsWithCandies(candies, extraCandies): list=[] for item in candies: if int(item)+extraCandies>=int(max(candies)): list.append("true") else: list.append("false") return list
上面的不知道為什麼一直報錯,list裡面的元素都是true.. 但是在自己的電腦上跑看起來沒問題啊
I don’t know why the above code has been reported error,all the elements in the list are true .. But running on my own computer looks fine
class Solution: def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]: lista=[] for item in candies: lista.append(item+extraCandies>=max(candies)) return lista
Write it in another way
換了一種方式寫就過了
文章標籤
全站熱搜
留言列表