diff --git a/problems/1143.最长公共子序列.md b/problems/1143.最长公共子序列.md index 2b5eed3d..68269b87 100644 --- a/problems/1143.最长公共子序列.md +++ b/problems/1143.最长公共子序列.md @@ -144,6 +144,11 @@ Java: */ class Solution { public int longestCommonSubsequence(String text1, String text2) { + // char[] char1 = text1.toCharArray(); + // char[] char2 = text2.toCharArray(); + // 可以在一開始的時候就先把text1, text2 轉成char[],之後就不需要有這麼多爲了處理字串的調整 + // 就可以和卡哥的code更一致 + int[][] dp = new int[text1.length() + 1][text2.length() + 1]; // 先对dp数组做初始化操作 for (int i = 1 ; i <= text1.length() ; i++) { char char1 = text1.charAt(i - 1);