Practice Strange Printer
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 printer starts with a blank output. In one turn it prints any contiguous run of a single repeated character, choosing its start and end positions freely. Printing over existing positions replaces their characters. Return the fewest turns required to produce s.
Source: Strange Printer on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "aaabbb"
Output
2
# Example 2
Input
s = "aba"
Output
2
Constraints
1 <= s.length <= 100
s consists of lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Strange Printer.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.