上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 114 下一页
摘要: 先给出一个我自己写的方案,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+ 阅读(214) 评论(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+ 阅读(130) 评论(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+ 阅读(137) 评论(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) 编辑
摘要: 1 class Solution: 2 def summaryRanges(self, nums: List[int]) -> List[str]: 3 n = len(nums) 4 if n == 0: 5 return [] 6 pre = nums[0] 7 res = [[nums[0], 阅读全文
posted @ 2020-04-04 20:34 Sempron2800+ 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def computeArea(self, A: int, B: int, C: int, D: int, E: int, F: int, G: int, H: int) -> int: 3 x = 0 4 y = 0 5 6 if (A <= E): 7 i 阅读全文
posted @ 2020-04-04 10:14 Sempron2800+ 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def __init__(self): 3 self.count = 0 4 5 def preOrder(self,node): 6 if node != None: 7 self.count += 1 8 self.preOrder(node.left) 阅读全文
posted @ 2020-04-04 09:45 Sempron2800+ 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 1 class TrieNode: 2 def __init__(self): 3 self.words = 0 4 self.edges = [None] * 26 5 6 7 class WordDictionary: 8 def __init__(self): 9 self.root = Tr 阅读全文
posted @ 2020-04-04 08:48 Sempron2800+ 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int minSubArrayLen(int s, int[] nums) { 3 int idx1=0,idx2=0; 4 int currSum=0; 5 int ret=Integer.MAX_VALUE; 6 while(idx2<nu 阅读全文
posted @ 2020-04-03 09:31 Sempron2800+ 阅读(178) 评论(0) 推荐(0) 编辑
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 114 下一页