From 018c9cb96399a5005f6ed42e0eb69ebc07f24d97 Mon Sep 17 00:00:00 2001 From: Terry Liu <102352821+Lozakaka@users.noreply.github.com> Date: Thu, 15 Jun 2023 18:46:08 -0400 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ejava=202-D=20array=20?= =?UTF-8?q?=E5=BB=BA=E8=AD=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/1143.最长公共子序列.md | 5 +++++ 1 file changed, 5 insertions(+) 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);