摘要: 1 from heapq import heappush, heappop 2 class Solution: 3 def findTheCity(self, n: int, edges: 'List[List[int]]', distanceThreshold: int) -> int: 4 di 阅读全文
posted @ 2020-01-26 18:02 Sempron2800+ 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def filterRestaurants(self, restaurants: 'List[List[int]]', veganFriendly: int, maxPrice: int, maxDistance: int) -> 'List[int]': 3 阅读全文
posted @ 2020-01-26 14:41 Sempron2800+ 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def isPalindrome(self,s): 3 n = len(s) 4 i,j = 0,n-1 5 while i < j: 6 if s[i] != s[j]: 7 return False 8 i += 1 9 j -= 1 10 return 阅读全文
posted @ 2020-01-26 14:06 Sempron2800+ 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def arrayRankTransform(self, arr: List[int]) -> List[int]: 3 n = len(arr) 4 if n == 0: 5 return [] 6 sortlist = sorted(arr) 7 dic 阅读全文
posted @ 2020-01-26 05:51 Sempron2800+ 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def diagonalSort(self, mat: 'List[List[int]]') -> 'List[List[int]]': 3 m = len(mat) 4 n = len(mat[0]) 5 6 i,j = m-1,0 7 while i != 阅读全文
posted @ 2020-01-26 05:49 Sempron2800+ 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def breakPalindrome(self, palindrome: str) -> str: 3 n = len(palindrome) 4 if n <= 1: 5 return '' 6 half = n // 2 7 sub = palindro 阅读全文
posted @ 2020-01-26 05:12 Sempron2800+ 阅读(157) 评论(0) 推荐(0) 编辑