Interview Query

String Subsequence

Have you seen this question before?

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.



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

is_subsequence(string1, string2) -> True
is_subsequence(string1, string3) -> False
Next question: New Resumes
Python 3.9.6
Loading editor
Use Shift + Enter to run code