上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 114 下一页
摘要: 1 class Solution: 2 def __init__(self): 3 self.l = [] 4 5 def preOrder(self,node,temp): 6 if node != None: 7 temp.append(str(node.val)) 8 if node.left 阅读全文
posted @ 2020-03-01 13:59 Sempron2800+ 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def rankTeams(self, votes: 'List[str]') -> str: 3 dic = {} 4 n = len(votes) 5 m = len(votes[0]) 6 mat = [[0 for _ in range(26)] fo 阅读全文
posted @ 2020-03-01 13:56 Sempron2800+ 阅读(283) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: 3 sorted_nums = sorted(nums) 4 n = len(nums) 5 index = 0 6 dic 阅读全文
posted @ 2020-03-01 13:54 Sempron2800+ 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def closestDivisors(self, num: int) -> List[int]: 3 d = float("inf") 4 res = [] 5 for i in range(1, int((num + 1) ** 0.5 + 1)): 6 阅读全文
posted @ 2020-02-23 17:34 Sempron2800+ 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 1 class TreeNode: 2 def __init__(self, x): 3 self.val = x 4 self.left = None 5 self.right = None 6 7 class Solution: 8 def __init__(self): 9 self.node 阅读全文
posted @ 2020-02-23 16:32 Sempron2800+ 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 1 import datetime 2 class Solution: 3 def daysBetweenDates(self, date1: str, date2: str) -> int: 4 year1,month1,day1 = date1.split('-') 5 d1 = datetim 阅读全文
posted @ 2020-02-23 13:49 Sempron2800+ 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def numberOfSubstrings(self, s: str) -> int: 3 n = len(s) 4 prelist = [] 5 for i in range(n): 6 a_index = s.find('a',i) 7 b_index 阅读全文
posted @ 2020-02-23 13:44 Sempron2800+ 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1 class Cashier: 2 def __init__(self, n: int, discount: int, products: 'List[int]', prices: 'List[int]'): 3 self.customer_num = 0 4 self.dic = {} 5 m 阅读全文
posted @ 2020-02-23 13:08 Sempron2800+ 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1 import collections 2 class Solution: 3 def countBitOnes(self,num): 4 count = 0 5 for i in range(14): 6 if num & 1 == 1: 7 count += 1 8 num >>= 1 9 r 阅读全文
posted @ 2020-02-23 07:35 Sempron2800+ 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def maxEvents(self, events: 'List[List[int]]') -> int: 3 events.sort(key=lambda item: (item[1], item[0])) 4 days = set() 5 for sta 阅读全文
posted @ 2020-02-16 19:00 Sempron2800+ 阅读(174) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 114 下一页