1717. Maximum Score From Removing Substrings
https://leetcode.com/problems/maximum-score-from-removing-substrings
Description
You are given a string s
and two integers x
and y
. You can perform two types of operations any number of times.
Remove substring
"ab"
and gainx
points.For example, when removing
"ab"
from"cabxbae"
it becomes"cxbae"
.
Remove substring
"ba"
and gainy
points.For example, when removing
"ba"
from"cabxbae"
it becomes"cabxe"
.
Return the maximum points you can gain after applying the above operations on s
.
Example 1:
Example 2:
Constraints:
1 <= s.length <= 105
1 <= x, y <= 104
s
consists of lowercase English letters.
ac
Previous1716. Calculate Money in Leetcode BankNext1718. Construct the Lexicographically Largest Valid Sequence
Last updated