Given two strings s and t, return true if s is a subsequence of t, and false otherwise. A subsequence keeps the relative order of characters but does not require contiguity. Pattern focus: LCS. This is a smaller state version of subsequence dynamic programming and is a standard entry point into string DP.
s = source string, t = target string
true if s is a subsequence of t, otherwise false
Example 1:
Input:
s = "abc" t = "ahbgdc"
Output:
true
Explanation:
The characters a, b, c appear in order inside t.
Example 2:
Input:
s = "axc" t = "ahbgdc"
Output:
false
Explanation:
The character x does not appear in t in the required order.