上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 47 下一页
摘要: 题目描述: 方法一:正则 class Solution: def isPalindrome(self, s: str) -> bool: return ''.join(re.findall('\w*',s)).lower() == ''.join(re.findall('\w*',s)).lower 阅读全文
posted @ 2019-07-15 19:09 oldby 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: class Solution: def maxProfit(self, prices: List[int], fee: int) -> int: n = len(prices) dp_i_0 = 0 dp_i_1 = float('-inf') for i in range(0 阅读全文
posted @ 2019-07-15 18:55 oldby 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: class Solution: def maxProfit(self, prices: List[int]) -> int: n = len(prices) dp_i_0 = 0 dp_i_1 = float('-inf') dp_pre_0 = 0 for i in rang 阅读全文
posted @ 2019-07-15 18:54 oldby 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: if len(prices) <= 1: return 0 if (k < len(prices) // 2) : dp = [[-pr 阅读全文
posted @ 2019-07-15 18:53 oldby 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: class Solution: def maxProfit(self, prices: List[int]) -> int: dp_i1_0 = 0 dp_i1_1 = float('-inf') dp_i2_0 = 0 dp_i2_1 = float('-inf') for 阅读全文
posted @ 2019-07-15 18:50 oldby 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: class Solution: def maxProfit(self, prices: List[int]) -> int: profit = 0 for i in range(1,len(prices)): tem = prices[i] - prices[i-1] if t 阅读全文
posted @ 2019-07-15 14:18 oldby 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目描述; 方法一:O(n) O(1) class Solution: def maxProfit(self, prices: List[int]) -> int: minprices = float('inf') maxprofit = 0 for i in prices: if i<minpri 阅读全文
posted @ 2019-07-15 11:38 oldby 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 第一次提交:动态规划 class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: n = len(triangle) for i in range(n-2,-1,-1): for j in range 阅读全文
posted @ 2019-07-15 11:19 oldby 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 第一次提交: class Solution: def getRow(self, rowIndex: int) -> List[int]: k = rowIndex pre = [1] + [0] * k res = [1] + [0] * k for i in range(1,k+1): 阅读全文
posted @ 2019-07-15 10:48 oldby 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 输入:{"$id":"1","left":{"$id":"2","left":{"$id":"3","left":null,"next":null,"right":null,"val":4},"next":null,"right":{"$id":"4","l 阅读全文
posted @ 2019-07-14 20:46 oldby 阅读(123) 评论(0) 推荐(0) 编辑
上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 47 下一页