From 25b4dfdc709753c2efc5515c488eda6e21a6f806 Mon Sep 17 00:00:00 2001 From: hanggegreat Date: Sat, 29 Jun 2019 12:42:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAleetcode392=E9=A2=98=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E6=8C=91=E6=88=98=E9=A2=98=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notes/Leetcode 题解 - 贪心思想.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notes/Leetcode 题解 - 贪心思想.md b/notes/Leetcode 题解 - 贪心思想.md index a316822d..63469fca 100644 --- a/notes/Leetcode 题解 - 贪心思想.md +++ b/notes/Leetcode 题解 - 贪心思想.md @@ -275,7 +275,7 @@ public boolean isSubsequence(String s, String t) { 对于这个后续挑战,因为有10亿以上的S,所以不能每次都去遍历T,而是应该把T的序列保存下来 -定义一个dp数组,int [][]dp = new int[t.length()][26],其中dp[i][j] 表示T的i位置及之后,(j + 'a')对应的字符最早出现的位置 +定义一个dp数组: int [][]dp = new int[t.length()][26],其中dp[i][j] 表示T的i位置及之后,j + 'a'字符最早出现的位置 之后对S进行遍历,用tIndex记录T所到达的位置,并判断T的tIndex位置及之后是否有S当前位置元素,遍历完成返回true,如果在这期间tIndex越界,则返回false