Problem · String
Maximum String Operations
Learn this problemProblem statement
Choose three consecutive characters whose first two are equal and whose third differs, then replace the third with the repeated character. Apply the operation any number of times and return the maximum possible operation count.
Function
getMaximumOperations(s: String) → longExamples
Example 1
s = "accept"return = 3The pair cc can successively absorb e, p, and t.
Example 2
s = "aabaab"return = 2Two differing characters can be changed by the available repeated-a pairs.
Constraints
3 <= s.length <= 200000scontains lowercase English letters.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024