leetcode 刷题的时候,遇到下列错误。
1 class Solution: ----> 2 def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]: 3 #遍历所有的孩子 4 #增加糖果数量 5 #查看是否是最多的糖果,是,if_max,增加True NameError: name 'List' is not defined
在最前部增加:
from typing import List
解决问题。