Grokking Google Coding Interview
Ask Author
Back to course home

0% completed

Solution: Is Subsequence

Problem Statement

Given two strings s and t, return true if the string s is a subsequence of the string t. Otherwise, return false.

A subsequence of a string is a new string that can be formed from the original string by eliminating some (can be zero) of the characters without changing the order of the remaining characters.

Examples

  • Example 1:
    • Input: s = "hello", t = "xyhealoloo"
    • Expected Output: true
    • Justification: By removing "x", "y", "a", "o", and the second "o" from t, `s

.....

.....

.....

Like the course? Get enrolled and start learning!