You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
如果有大量输入的 S,称作 S1, S2, ... , Sk 其中 k >= 10亿,你需要依次检查它们是否为 T 的子序列。在这种情况下,你会怎样改变代码?
10
13
11
-
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 a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, `"ace"` is a subsequence of `"abcde"` while `"aec"` is not).
20
+
....
21
+
输入:s = "abc", t = "ahbgdc"
22
+
输出:true
23
+
....
16
24
25
+
*示例 2:*
17
26
18
-
*Example 1:*
27
+
....
28
+
输入:s = "axc", t = "ahbgdc"
29
+
输出:false
30
+
....
19
31
32
+
*提示:*
20
33
21
-
*s* = `"abc"`, *t* = `"ahbgdc"`
22
-
23
-
24
-
Return `true`.
25
-
26
-
27
-
*Example 2:*
28
-
29
-
30
-
*s* = `"axc"`, *t* = `"ahbgdc"`
31
-
32
-
33
-
Return `false`.
34
-
35
-
36
-
*Follow up:*
37
-
38
-
39
-
If there are lots of incoming S, say S1, S2, ... , Sk where k >= 1B, and you want to check one by one to see if T has its subsequence. In this scenario, how would you change your code?
40
-
41
-
*Credits:*
42
-
43
-
Special thanks to <ahref="https://leetcode.com/pbrother/">@pbrother</a> for adding this problem and creating all test cases.
0 commit comments