摘要: 感觉把题解法和思路直接写在LeetCode网站上就好了,写博客麻烦了。 class Solution { int deleteIslands(int i,int j,char [][]grid,int [][]foot){ foot[i][j] =1; if(grid[i][j] == '0') r 阅读全文
posted @ 2021-09-29 23:17 你的雷哥 阅读(93) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int[][] floodFill(int[][] image, int sr, int sc, int newColor) { int [][]foot = new int[image.length][image[0].length]; delete 阅读全文
posted @ 2021-09-29 23:15 你的雷哥 阅读(85) 评论(0) 推荐(0) 编辑
摘要: class Solution { void perm(int level, int []nums, List<List<Integer>> list){ if(level==nums.length){ ArrayList<Integer> listSingle = new ArrayList<>() 阅读全文
posted @ 2021-09-29 23:14 你的雷哥 阅读(61) 评论(0) 推荐(0) 编辑
摘要: dfs,主要记住结束递归要用return class Solution { int judge(char [][]board,int iIndex,int jIndex,char s){ int flag = 0; for(int j=0;j<9;j++){ if(board[iIndex][j] 阅读全文
posted @ 2021-09-29 23:13 你的雷哥 阅读(112) 评论(0) 推荐(0) 编辑
摘要: class Solution { /** 1,初始方向向上 2.一轮指令后,方向可能不变,也可能变 3.方向发生变化,最多四次迭代就能变回初始方向,而且一定能变回初始方向。这点很重要,大家想一想 4.不管是第一轮指定还是第N轮指定以后,第一次达到同方向,看这次的位置是不是(0,0),如果是,则困于循 阅读全文
posted @ 2021-09-29 23:12 你的雷哥 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 模拟 class Solution { public boolean validateStackSequences(int[] pushed, int[] popped) { int pushNum = pushed.length; int poped = popped.length; int in 阅读全文
posted @ 2021-09-29 23:11 你的雷哥 阅读(55) 评论(0) 推荐(0) 编辑
摘要: class Solution { public String addStrings(String num1, String num2) { String value = ""; int dub = 0; //记录上次结果是否大于10 for(int i=1;i<=Math.max(num1.leng 阅读全文
posted @ 2021-09-29 23:10 你的雷哥 阅读(62) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int maximumGap(int[] nums) { if(nums.length <2) return 0; else{ Arrays.sort(nums); int array[] = new int[nums.length-1]; for(i 阅读全文
posted @ 2021-09-29 10:07 你的雷哥 阅读(67) 评论(0) 推荐(0) 编辑