Watch 10 video solutions for Strange Printer, a hard level problem involving String, Dynamic Programming. This walkthrough by codestorywithMIK has 15,614 views views. Want to try solving it yourself? Practice on FleetCode or read the detailed text solution.
There is a strange printer with the following two special properties:
Given a string s, return the minimum number of turns the printer needed to print it.
Example 1:
Input: s = "aaabbb" Output: 2 Explanation: Print "aaa" first and then print "bbb".
Example 2:
Input: s = "aba" Output: 2 Explanation: Print "aaa" first and then print "b" from the second place of the string, which will cover the existing character 'a'.
Constraints:
1 <= s.length <= 100s consists of lowercase English letters.