上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 47 下一页
摘要: 题目描述: 自己的提交: class Solution: def minAvailableDuration(self, slots1: List[List[int]], slots2: List[List[int]], duration: int) -> List[int]: res = [] i, 阅读全文
posted @ 2019-10-21 11:45 oldby 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def missingNumber(self, arr: List[int]) -> int: if len(arr) == 2: return arr[0] + (arr[1] - arr[0]) //2 if len(set(arr)) 阅读全文
posted @ 2019-10-21 11:29 oldby 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 方法: class Solution: def jobScheduling(self, startTime: List[int], endTime: List[int], profit: List[int]) -> int: idx=[i for i in range(len(startTime)) 阅读全文
posted @ 2019-10-21 11:01 oldby 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法: 另: class Solution: def balancedString(self, s: str) -> int: n, req = len(s), len(s) // 4 c_all = collections.Counter(s) c_cur = collections. 阅读全文
posted @ 2019-10-21 09:56 oldby 阅读(306) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def removeSubfolders(self, folder: List[str]) -> List[str]: d = {} res = [] for f in folder: l_f = f.split("/")[1:] node 阅读全文
posted @ 2019-10-21 09:22 oldby 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 自己的提交: class Solution: def checkStraightLine(self, coordinates: List[List[int]]) -> bool: if not coordinates: return False if len(coordinates) <= 2: r 阅读全文
posted @ 2019-10-21 09:06 oldby 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一:动态规划 class Solution: def minCut(self, s: str) -> int: min_s = list(range(len(s))) n = len(s) dp = [[False] * n for _ in range(n)] for i in r 阅读全文
posted @ 2019-10-19 21:06 oldby 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 题目描述: class Solution: def findLadders(self, beginWord: str, endWord: str, wordList: list) -> list: wordList = set(wordList) # 转换为hash实现O(1)的in判断 if en 阅读全文
posted @ 2019-10-19 10:28 oldby 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 题17: 方法一:回溯 class Solution: def letterCombinations(self, digits: str) -> List[str]: res = [] dic ={"2":"abc","3":"def","4":"ghi","5":"jkl","6":"mno"," 阅读全文
posted @ 2019-10-18 20:09 oldby 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一:回溯 class Solution: def totalNQueens(self, n: int) -> int: def backtrack(i,tmp,col,z_diagonal,i_diagonal): if i == n: nonlocal res res += 1 r 阅读全文
posted @ 2019-10-18 19:52 oldby 阅读(138) 评论(0) 推荐(0) 编辑
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 47 下一页