摘要:
先给出一个我自己写的方案,TLE 1 class Solution: 2 def __init__(self): 3 self.memo = dict() 4 self.memo[1] = True 5 6 def isUgly(self,num): 7 if num <= 0: 8 return 阅读全文
摘要:
1 class Solution: 2 def majorityElement(self, nums: List[int]) -> List[int]: 3 dic = dict() 4 n = len(nums) 5 for i in range(n): 6 if nums[i] not in d 阅读全文
摘要:
1 class Solution: 2 def checkOverlap(self, radius: int, x_center: int, y_center: int, x1: int, y1: int, x2: int, y2: int) -> bool: 3 4 # Getting the c 阅读全文
摘要:
1 class Solution: 2 def canConstruct(self, s: str, k: int) -> bool: 3 #奇数个字符出现的数量 <= k 4 #所有的字符的类别数量 >= k 5 dic = dict() 6 n = len(s) 7 for i in range 阅读全文
摘要:
1 class Solution: 2 def calSum(self,x): 3 s = str(x) 4 sums = 0 5 for j in range(len(s)): 6 sums += int(s[j]) 7 return sums 8 9 def countLargestGroup( 阅读全文