摘要: class Solution { public int countCornerRectangles(int[][] grid) { if(grid.length < 2 || grid[0].length < 2) return 0; int m = grid.length, n = grid[0] 阅读全文
posted @ 2020-07-21 16:37 Sexyomaru 阅读(134) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int numSubmat(int[][] mat) { if(mat.length == 0 || mat[0].length == 0) return 0; int m = mat.length, n = mat[0].length; int[][ 阅读全文
posted @ 2020-07-21 16:36 Sexyomaru 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 分析:dp[i][j]表示右下角坐标为(i,j)的最大正方形边长,累加即可 class Solution { public int countSquares(int[][] matrix) { if(matrix.length == 0 || matrix[0].length == 0) retur 阅读全文
posted @ 2020-07-21 16:33 Sexyomaru 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 位运算性质:a&b不会大于a也不会大于b,会将二进制中的1变为0,但是0不会变为1 a|b不会小于a也不会小于b,会将二进制中的0变为1,但是1不会变为0 class Solution { public int closestToTarget(int[] arr, int target) { Set 阅读全文
posted @ 2020-07-21 15:48 Sexyomaru 阅读(122) 评论(0) 推荐(0) 编辑