Is Subsequence Problem

Is Subsequence Problem — ExecCode Easy DSA Practice

Solve the Is Subsequence problem on ExecCode. Free online easy DSA practice in Two Pointers. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given two strings s and t, return true if s is a subsequence of t , or false otherwise. Your task is to a subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not). Return the required answer exactly as shown in the examples.

Examples

Input {"s": "abc", "t": "ahbgdc"}; Output True. Input {"s": "axc", "t": "ahbgdc"}; Output False

Constraints

0 <= s.length <= 100 0 <= t.length <= 10^4 s and t consist only of lowercase English letters.

Practice Is Subsequence free on ExecCode. Browse DSA problems, topic map, and placement guides.