08 2021 档案

摘要:力扣 39组合总和 public class combinationSum_1 { static List<List<Integer>> res; static LinkedList<Integer> tmp ; public static List<List<Integer>> combinati 阅读全文
posted @ 2021-08-08 14:45 weidalin 阅读(46) 评论(0) 推荐(0)
摘要:力扣 200 岛屿数量 public class numIslands_1 { private int res; public int numIslands(char[][] grid) { res = 0; for(int i = 0; i < grid.length; i++){ for(int 阅读全文
posted @ 2021-08-08 14:44 weidalin 阅读(102) 评论(0) 推荐(0)
摘要:力扣 139单词拆分 写法1 class Solution { Boolean[] visited; List<String> wordDict; String s; public boolean wordBreak(String s, List<String> wordDict) { visite 阅读全文
posted @ 2021-08-08 14:43 weidalin 阅读(66) 评论(0) 推荐(0)
摘要:dfs+回溯写题两种思路 主要框架 public void dfs(选择列表){ //1.找到结束条件 //2.遍历所有可能性 //2.1做选择 //2.2 递归调用自己进一步深度遍历 //3.回撤选择 } dfs函数的参数变量我觉得是越少越好,所以将一些不怎么改变的变量设置为全局变量更容易理清思路 阅读全文
posted @ 2021-08-08 14:42 weidalin 阅读(50) 评论(0) 推荐(0)