摘要: 1 class Solution: 2 def convertInt(self,s): 3 n = len(s) 4 basenum = 0 5 p = 0 6 for i in range(n-1,-1,-1): 7 basenum += int(s[i]) * (2 ** p) 8 p += 1 阅读全文
posted @ 2020-04-05 12:57 Sempron2800+ 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def minSubsequence(self, nums: 'List[int]') -> 'List[int]': 3 nums = sorted(nums,reverse=True) 4 n = len(nums) 5 if n == 1: 6 retu 阅读全文
posted @ 2020-04-05 12:55 Sempron2800+ 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 先给出一个我自己写的方案,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 阅读全文
posted @ 2020-04-05 09:53 Sempron2800+ 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-04-05 09:25 Sempron2800+ 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-04-05 05:05 Sempron2800+ 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-04-05 05:00 Sempron2800+ 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 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( 阅读全文
posted @ 2020-04-05 04:55 Sempron2800+ 阅读(168) 评论(0) 推荐(0) 编辑