mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-06 23:28:29 +08:00
@ -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);
|
||||
|
Reference in New Issue
Block a user