← ALL NOTES
Two Pointers

392. Is Subsequence

Is s a subsequence of t — do all of s's characters appear in t, in order, allowing gaps? A greedy two-pointer settles it in one pass: scan t, and each time you see the character s currently needs,…

Loading…