摘要: 题目描述: 提交:O(N) class Solution: def buildArray(self, target: List[int], n: int) -> List[str]: res = [] a = "Push" b = "Pop" index = 1 for i in target: w 阅读全文
posted @ 2020-05-10 22:07 oldby 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 提交:O(N3) class Solution: def countTriplets(self, arr: List[int]) -> int: # count = 0 # for i in range(len(arr)): # for j in range(i+1,len(arr)): 阅读全文
posted @ 2020-05-10 21:48 oldby 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 解:动态规划 参考自: 作者:coldme-2链接:https://leetcode-cn.com/problems/number-of-ways-of-cutting-a-pizza/solution/dong-tai-gui-hua-by-coldme-2-2/来源:力扣(LeetC 阅读全文
posted @ 2020-05-10 21:30 oldby 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一:dfs 从父节点到子节点 class Solution: def minTime(self, n: int, edges: List[List[int]], hasApple: List[bool]) -> int: maps = collections.defaultdict( 阅读全文
posted @ 2020-05-10 21:07 oldby 阅读(164) 评论(0) 推荐(0) 编辑