Minimum Remaining Length
Updated
Problem 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 Online Assessment questions
- Server Upgrade PlanningOA · Seen Nov 2026
- Student and Course EnrollmentOA · Seen Nov 2026
- Bond Interest Summary Above 3%OA · Seen Oct 2026
- Count Phrases Formed by Anagram ReplacementOA · Seen Oct 2026
- Event Statistics AggregatorOA · Seen Sep 2026
- Ordered Deployment Configuration ValidatorOA · Seen Sep 2026
- Longest Subsequence That Is a SubstringOA · Seen Jul 2026
- Overloaded Game Account InventoriesOA · Seen Jul 2026
- Count Server ReplacementsOA · PHONE SCREEN · Seen Feb 2026
- High Resource Usage CustomersOA · Seen Nov 2025
Similar questions at other companies
- Basic Calculator IITypeSafe AI · OA
- Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
- Adjacent Pair and Run RemovalWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
- Remove Parentheses from a Plus-Minus ExpressionOracle · PHONE SCREENOracle interview questions
- Parse a Partial JSON StreamListen Labs · PHONE SCREEN
- Decode StringCompass International Holdings · PHONE SCREENCompass International Holdings interview questions
- Remove K DigitsProcol · PHONE SCREEN
- Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
- Inverse-Depth Nested List SumLinkedIn · PHONE SCREENLinkedIn interview questions
- Multiline Text Editor with Cursor MovementDatologyAI · PHONE SCREEN