上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 114 下一页
摘要: 1 class ProductOfNumbers: 2 def __init__(self): 3 self.matrix = [] 4 self.preproducts = [] 5 self.length = 0 6 self.zeros = set() 7 8 def add(self, nu 阅读全文
posted @ 2020-02-16 14:34 Sempron2800+ 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 1 import bisect 2 class Solution: 3 def countNegatives(self, grid: 'List[List[int]]') -> int: 4 m = len(grid) 5 n = len(grid[0]) 6 sums = 0 7 for i in 阅读全文
posted @ 2020-02-16 13:39 Sempron2800+ 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 1 import bisect 2 class TweetCounts: 3 def __init__(self): 4 self.records = {} 5 6 def recordTweet(self, tweetName: str, time: int) -> None: 7 if twee 阅读全文
posted @ 2020-02-09 14:27 Sempron2800+ 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def minSteps(self, s: str, t: str) -> int: 3 n = len(s) 4 dic1 = {} 5 for i in range(n): 6 cur = s[i] 7 if cur not in dic1: 8 dic1 阅读全文
posted @ 2020-02-09 12:05 Sempron2800+ 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def checkIfExist(self, arr: List[int]) -> bool: 3 s = set() 4 n = len(arr) 5 for i in range(n): 6 cur = arr[i] 7 if cur in s: 8 re 阅读全文
posted @ 2020-02-09 12:04 Sempron2800+ 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def angleClock(self, hour: int, minutes: int) -> float: 3 m_angle = minutes * 6 4 h_angle = (hour + minutes / 60) * 6 * 5 if hour 阅读全文
posted @ 2020-02-09 09:40 Sempron2800+ 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def numOfSubarrays(self, arr: List[int], k: int, threshold: int) -> int: 3 n = len(arr) 4 count = 0 5 sums = sum(arr[:k]) 6 avg = 阅读全文
posted @ 2020-02-09 09:27 Sempron2800+ 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def numberOfSteps (self, num: int) -> int: 3 count = 0 4 while num != 0: 5 count += 1 6 if num & 1 == 1: 7 num -= 1 8 else: 9 num 阅读全文
posted @ 2020-02-09 09:07 Sempron2800+ 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def __init__(self): 3 self.subTrees = [] 4 self.sums = 0 5 self.memo = {} 6 def preOrder(self,root): 7 if root != None: 8 self.sum 阅读全文
posted @ 2020-02-02 12:58 Sempron2800+ 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def minSetSize(self, arr: 'List[int]') -> int: 3 m = len(arr) 4 dic = {} 5 for i in range(m): 6 if arr[i] in dic: 7 dic[arr[i]] += 阅读全文
posted @ 2020-02-02 12:54 Sempron2800+ 阅读(171) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 114 下一页