algorythms
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

Inputs = "abc", t = "ahbgdc"
Outputtrue
Why

We can find "a", "b", "c" in order within "ahbgdc".

Hints — reveal one at a time