摘要:
1.回文子串 class Solution { public int countSubstrings(String s) { int res = 0 , n = s.length(); for(int i = 0;i<n;i++){ int l = i, r = i; while(l>=0&&r<n 阅读全文
摘要:
1.力扣72--编辑距离 class Solution { //典型动态对话问题 public int minDistance(String word1, String word2) { int m = word1.length(), n = word2.length(); int[][] dp = 阅读全文
摘要:
1.力扣406--根据身高重建队列 class Solution { //将二维数组按照不同人的身高升序排列,如果身高相同则按照位置降序排列 public int[][] reconstructQueue(int[][] people) { Arrays.sort(people, new Compa 阅读全文
摘要:
1.力扣394--字符串解码 class Solution { public String res; public int i; public String decodeString(String s) { res = new String(); int n = s.length(); i = 0; 阅读全文
摘要:
1.力扣122--买卖股票的最佳时机2 class Solution { public int maxProfit(int[] prices) { int n = prices.length; int[][] dp = new int[n][2]; //二维动态规划, dp[0][0] = 0;dp 阅读全文