Two Pointers
LC #392Easy
Is Subsequence
Two Pointers
Problem
Given two strings s and t, return true if s is a subsequence of t, or false otherwise.
stringtwo-pointersdynamic-programming
Constraints
- ›0 ≤ s.length ≤ 100
- ›0 ≤ t.length ≤ 10⁴
- ›Both consist of lowercase English letters.
Example
Input
s = "abc", t = "ahbgdc"Output
trueWhy
We can find "a", "b", "c" in order within "ahbgdc".