3316. Find Maximum Removals From Source String
You are given a string
sourceof sizen, a stringpatternthat is a subsequence ofsource, and a sorted integer arraytargetIndicesthat contains distinct numbers in the range[0, n - 1].We define an operation as removing a character at an index
idxfromsourcesuch that:
idxis an element oftargetIndices.
patternremains a subsequence ofsourceafter removing the character.Performing an operation does not change the indices of the other characters in
source. For example, if you remove'c'from"acb", the character at index 2 would still be'b'.Return the maximum number of operations that can be performed.
A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.
1 | class Solution { |