leetcode392】的更多相关文章

Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100). A subsequence of…
public class Solution { public bool IsSubsequence(string s, string t) { ; ; while (i < s.Length && j < t.Length) { if (s[i] == t[j]) { i++; j++; } else { j++; } } if (i >= s.Length) { return true; } else { return false; } } } https://leet…
Description Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100). A sub…
原题链接 1 class Solution: 2 def isSubsequence(self, s: str, t: str) -> bool: 3 lens,lent = len(s),len(t) 4 i = j = 0 5 while i < lens and j < lent: 6 if s[i] == t[j]: 7 i += 1 8 j += 1 9 return i == lens…