Practice Minimum Cost Good Caption
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
A good caption has every maximal run of a single character at least three characters long. One operation changes one letter of caption to its immediate alphabet predecessor or successor, without wrapping beyond a or z. Return a good caption requiring the fewest operations, breaking ties lexicographically. If none exists, return the empty string.
Source: Minimum Cost Good Caption on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
caption = "cdcd"
"cccc"
# Example 2
caption = "aca"
"aaa"
# Example 3
caption = "bc"
""
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Cost Good Caption.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.