Interview Query

String Subsequence

Start Timer

0:00:00

Upvote
14
Downvote
Save question
Mark as completed
View comments (40)
Next question

Given two strings, string1 and string2, write a function is_subsequence to find out if string1 is a subsequence of string2.

Bonus: A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.

Example:

Input:

string1 = 'abc'
string2 = 'asbsc'
string3 = 'acedb'

is_subsequence(string1, string2) -> True
is_subsequence(string1, string3) -> False
.
.
.
.
.


Comments

Loading comments