摘要: 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+ 阅读(184) 评论(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+ 阅读(130) 评论(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+ 阅读(198) 评论(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) 编辑