dsa · easy
Is Subsequence
Return whether s is a subsequence of t: you can obtain s by deleting some (or no) characters from t without reordering the rest.
Arguments
s— candidate subsequencet— string that may contain s in order
Example
s = "abc", t = "ahbgdc" → true (take a, b, c in that order).
s = "axc", t = "ahbgdc" → false.
Constraints
0 <= s.length <= 100 0 <= t.length <= 4*10^4 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: "abc" "ahbgdc" Expected: true
Example 2
Input: "axc" "ahbgdc" Expected: false