Stack Bash - Master data structures and algorithms

Is subsequence

Easy
Given two strings s and t, write a function that returns True if s is a subsequence of t.
A subsequence means the characters of s show up in t in the same order. They don't have to be next to each other.
For example, given
s = "ace"
t = "abcde"
Your function should return True.
Given
s = "axc"
t = "ahbgdc"
Your function should return False.
An empty s is a subsequence of every t.
The starter uses s in t. In Python that checks for a substring, not a subsequence. Run it first.

Try it first

Solution

7 Essential DSA in the AI era Coding Interview Problems

Master DSA in the AI era by trying the coding challenges below.
  1. 1.Count occurrencesEasy
  2. 2.Fix the default listEasy
  3. 3.Move zeroesEasy
  4. 4.Is subsequenceEasy
  5. 5.First unique characterEasy
  6. 6.Group anagramsMedium
  7. 7.Climb stairsEasy