摘要: 1 class Solution: 2 def longestSubsequence(self, arr: List[int], difference: int) -> int: 3 dp = collections.defaultdict(int) 4 result = 0 5 for val in arr: 6 ... 阅读全文
posted @ 2019-10-21 00:30 Sempron2800+ 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def checkStraightLine(self, coordinates: List[List[int]]) -> bool: 3 (u, v), (p, q) = coordinates[: 2] 4 for x, y in coordinates: 5 if (x - u) * (y... 阅读全文
posted @ 2019-10-21 00:24 Sempron2800+ 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def missingNumber(self, arr: 'List[int]') -> int: 3 n = len(arr) 4 common = (arr[n-1] - arr[0]) // n 5 if common == 0: 6 return 0 7 for i in range(n): 8 need = arr[0] + common * i 阅读全文
posted @ 2019-10-21 00:07 Sempron2800+ 阅读(200) 评论(0) 推荐(0) 编辑