Search
⌘K

Leetcode 1898. Maximum Number of Removable Characters

Given strings s and p and an ordered list of removable indices, find the maximum k such that after deleting the first k indices from s, p remains a subsequence of the resulting string. The key is recognizing the monotonic property (if p is a subsequence after k deletions it is after any fewer), enabling a binary-search over k with a greedy subsequence check.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.