解题思路贪心 解题思路 贪心基于前一相等字符的索引对比得出当前元素 public boolean isSubsequence(String s,String t){ char[] chars = s.toCharArray(); int index = -1; for(char temp:chars){ index = t.indexOf(temp, index + 1); if(index == -1) return false; } return true; }