上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 33 下一页
摘要: 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 欣姐姐 阅读(285) 评论(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 欣姐姐 阅读(197) 评论(0) 推荐(0)
摘要: 想着每个标签做20道题进行练习 以上是数组标签前20道题中完成的题目,还有三个没完成,54是没地方写程序,前两个是自己运行可以但是上传就不对了。 无论如何也算是完成了一小步,接下来进行下一个目标,动态规划!!!! 动态规划(英语:Dynamic programming,简称 DP)是一种在数学、管理 阅读全文
posted @ 2019-10-14 15:13 欣姐姐 阅读(129) 评论(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 欣姐姐 阅读(233) 评论(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 欣姐姐 阅读(213) 评论(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 欣姐姐 阅读(152) 评论(0) 推荐(0)
摘要: 好开心!!!我做到了!!!! 第一次独立完成回溯+剪枝。 class Solution(object): def combinationSum2(self, candidates, target): """ :type candidates: List[int] :type target: int 阅读全文
posted @ 2019-10-14 11:20 欣姐姐 阅读(177) 评论(0) 推荐(0)
摘要: 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。 说明: 所有数字(包括 target)都是正整数。解集不能包含重复的组合。 示例 1: 输入: 阅读全文
posted @ 2019-10-13 21:35 欣姐姐 阅读(142) 评论(0) 推荐(0)
摘要: 题目描述: 实现获取下一个排列的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列。 如果不存在下一个更大的排列,则将数字重新排列成最小的排列(即升序排列)。 必须原地修改,只允许使用额外常数空间。 以下是一些例子,输入位于左侧列,其相应输出位于右侧列。1,2,3 → 1,3,23,2, 阅读全文
posted @ 2019-10-13 20:19 欣姐姐 阅读(229) 评论(0) 推荐(0)
摘要: 用时29分09秒: 滑动窗口虽然不懂具体是什么概念,但是用到的应该是这个思路: public int lengthOfLongestSubstring(String s) { int n = s.length(); if(n<2) return n; int i =0,j=1,max_len=1; 阅读全文
posted @ 2019-10-12 14:41 欣姐姐 阅读(202) 评论(0) 推荐(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 33 下一页