摘要: 这道题的动态规划,我自己没有想清楚,看了答案之后才恍然大悟,不难。 public boolean wordBreak(String s, List<String> wordDict) { boolean[] f = new boolean[s.length()+1]; f[0] = true; fo 阅读全文
posted @ 2020-06-27 21:45 欣姐姐 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 还好做出来了,就是慢了点。 public int numDistinct(String s, String t) { int m = s.length(); int n = t.length(); if(m<n){ return 0; }else if(m ==n){ if(s.equals(t)) 阅读全文
posted @ 2020-06-27 17:36 欣姐姐 阅读(74) 评论(0) 推荐(0) 编辑
摘要: import static java.lang.Integer.min; class Solution { public int minDistance(String word1, String word2) { int m = word1.length(); int n = word2.lengt 阅读全文
posted @ 2020-06-27 14:40 欣姐姐 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 动态规划,还是学不会,,这道题好难啊!!!! 但是思路对了之后又是如此清晰。 public boolean isScramble(String s1, String s2) { if(s1.length() != s2.length()){ return false; } int len = s1. 阅读全文
posted @ 2020-06-27 13:11 欣姐姐 阅读(165) 评论(0) 推荐(0) 编辑