Is Subsequence

Given two strings s and t, return true if s is a subsequence of t, and false otherwise. A subsequence is formed by deleting zero or more characters without…

Given two strings `s` and `t`, return `true` if `s` is a **subsequence** of `t`, and `false` otherwise. A subsequence is formed by deleting zero or more characters without changing the relative order of the remaining characters. The selected characters do not need to be adjacent. For example, `"ace"` is a subsequence of `"abcde"`, but `"aec"` is not.

- `0 <= s.length, t.length <= 100` - `s` and `t` consist of lowercase English letters. - The empty string is a subsequence of every string.

Example 1: input s = "abc", t = "ahbgdc"; output true. Choose a at index 0, b at index 2, and c at index 5 of t.

Example 2: input s = "axc", t = "ahbgdc"; output false. No x appears after the chosen a, so the required order cannot be completed.

Example 3: input s = "", t = "abc"; output true. Deleting every character of t leaves the empty string.

Category: Strings. Topic: strings. Difficulty: Easy. Patterns: two-pointers, string-processing.