摘要: class Solution: def minPathSum(self, grid) -> int: m=len(grid) n=len(grid[0]) if m==0 or n==0: return 0 if m==1 and n==1: return grid[0][0] for i in r 阅读全文
posted @ 2019-10-14 20:19 欣姐姐 阅读(228) 评论(0) 推荐(0) 编辑
摘要: class Solution: def uniquePathsWithObstacles(self, obstacleGrid) -> int: if len(obstacleGrid)<1: return 0 m=len(obstacleGrid) n=len(obstacleGrid[0]) i 阅读全文
posted @ 2019-10-14 19:54 欣姐姐 阅读(281) 评论(0) 推荐(0) 编辑
摘要: class Solution: def uniquePaths(self, m: int, n: int) -> int: memo=[[0 for i in range(n)] for i in range(m)]#定义空二维数组 for i in range(n): memo[0][i]=1 f 阅读全文
posted @ 2019-10-14 18:06 欣姐姐 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 想着每个标签做20道题进行练习 以上是数组标签前20道题中完成的题目,还有三个没完成,54是没地方写程序,前两个是自己运行可以但是上传就不对了。 无论如何也算是完成了一小步,接下来进行下一个目标,动态规划!!!! 动态规划(英语:Dynamic programming,简称 DP)是一种在数学、管理 阅读全文
posted @ 2019-10-14 15:13 欣姐姐 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 可能是找到了对的学习方法,更有感觉,就清晰地做出来就觉得很开心。 class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: None Do not return anythi 阅读全文
posted @ 2019-10-14 15:06 欣姐姐 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 我真的是超开心了,又做对了!!!!!!而且没走啥弯路!!!!!!! class Solution(object): def jump(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums)<2: return 0 pac 阅读全文
posted @ 2019-10-14 13:37 欣姐姐 阅读(203) 评论(0) 推荐(0) 编辑
摘要: class Solution(object): def firstMissingPositive(self, nums): """ :type nums: List[int] :rtype: int """ if nums==[]: return 1 for i in nums: if i<=0: 阅读全文
posted @ 2019-10-14 11:56 欣姐姐 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 好开心!!!我做到了!!!! 第一次独立完成回溯+剪枝。 class Solution(object): def combinationSum2(self, candidates, target): """ :type candidates: List[int] :type target: int 阅读全文
posted @ 2019-10-14 11:20 欣姐姐 阅读(167) 评论(0) 推荐(0) 编辑