上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 114 下一页
摘要: 1 class Solution: 2 def kWeakestRows(self, mat: 'List[List[int]]', k: int) -> 'List[int]': 3 m = len(mat) 4 n = len(mat[0]) 5 counter = [0] * m 6 for 阅读全文
posted @ 2020-02-02 12:53 Sempron2800+ 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 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+ 阅读(171) 评论(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+ 阅读(181) 评论(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+ 阅读(99) 评论(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+ 阅读(206) 评论(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+ 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def __init__(self): 3 self.tag = True 4 5 def preOrder(self,root,target): 6 if root != None: 7 if root.left != None: 8 if root.lef 阅读全文
posted @ 2020-01-19 21:16 Sempron2800+ 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def printVertically(self, s: str) -> 'List[str]': 3 words = s.split(' ') 4 matrix = [] 5 maxlen = 0 6 for w in words: 7 maxlen = m 阅读全文
posted @ 2020-01-19 20:53 Sempron2800+ 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution: 2 def maximum69Number (self, num: int) -> int: 3 result = '' 4 str_num = str(num) 5 i = 0 6 while i < len(str_num): 7 if str_num[i] 阅读全文
posted @ 2020-01-19 20:34 Sempron2800+ 阅读(145) 评论(0) 推荐(0) 编辑
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 114 下一页