Problem · String
Minimum Remaining Length
Learn this problemProblem statement
You are given a string seq made up only of the characters 'A' and 'B'.
You may repeatedly perform the following operation:
- Delete any occurrence of the substring
"AB"or"BB". - After deletion, the remaining parts of the string are concatenated.
Your task is to determine the minimum possible length of the string after performing any number of valid deletions.
Note: A substring refers to a contiguous sequence of characters.
Return the minimum remaining length.
Function
getMinimumRemainingLength(seq: String) → intExamples
Example 1
seq = "BABBA"return = 1More Wells Fargo problems
- Count Server ReplacementsOA · Seen Feb 2026
- Compressing ArraySeen Dec 2024
- Sum of Compressed Number for All SubarraysSeen May 2024
- Allocate Wells for Fair DistributionSeen Oct 2023
- Count OperationsSeen Aug 2023
- Find Maximum DistanceSeen Aug 2023
- Get SubstringSeen Aug 2023
- Find Last Affected SystemSeen May 2022