随笔分类 - 算法
摘要:class Solution { public List<List<Integer>> permuteUnique(int[] nums) { int length = nums.length; List<List<Integer>> res = new ArrayList<>(); if(leng
阅读全文
摘要:public int findMaxForm(String[] strs, int m, int n) { int length = strs.length; int[][][] dp = new int[length + 1][m + 1][n + 1]; for (int i = 1; i <=
阅读全文
摘要:给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 例如,121 是回文,而 123 不是。 若干种解法: 方法一: public boolean isPalindrome(int x) { Str
阅读全文
摘要:在一个由 '0' 和 '1' 组成的二维矩阵内,找到只包含 '1' 的最大正方形,并返回其面积。 public int maximalSquare(char[][] matrix) { if (matrix.length == 0) return 0; int rows = matrix.lengt
阅读全文