less than 1 minute read

Given two lowercase alphabet strings s1 and s2, determine if s1 is a subsequence of s2.

Constraints

  • n ≤ 100,000 where n is the length of s1
  • m ≤ 100,000 where m is the length of s2

https://binarysearch.com/problems/Subsequence-Strings

Examples

Example 1

Input

  • s1 = ppl
  • s2 = apple

Output

  • answer = True

Example 2

Input

  • s1 = ale
  • s2 = apple

Output

  • answer = True

Example 3

Input

  • s1 = elppa
  • s2 = apple

Output

  • answer = False

Solution

Leave a comment