You are given two strings s and t. Your task is to check whether s is a subsequence of t. A string is called a subsequence if all its characters appear in the same order in the other string, though not necessarily consecutively.
Example 1
Input: s = "ace", t = "abcde"
Output: true
Explanation: Characters a, c, and e appear in the same order in "abcde".
Example 2
Input: s = "aec", t = "abcde"
Output: false
Explanation: Characters are not in the required order.
Example 3
Input: s = "abc", t = "abc"
Output: true
Explanation: Both strings are identical, so it is a subsequence.
Sign in to write, run, and submit your solution against the full test suite.