摘要:
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)
编辑
摘要:
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)
编辑
摘要:
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)
编辑
摘要:
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)
编辑
摘要:
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)
编辑
摘要:
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)
编辑