Given a string s, you have two types of operation:
Your task is to minimize the length of s by performing the above operations zero or more times.
Return an integer denoting the length of the minimized string.
Examples
Example 1
Input: s = "aaabc"
Output: 3
Explanation:
Example 2
Input: s = "cbbd"
Output: 3
Explanation:
Example 3
Input: s = "baadccab"
Output: 4
Explanation:
Constraints
1 <= s.length <= 100
s contains only lowercase English letters
2716. Minimize String Length
Easy
10 Points
Hash Table
String
Given a string s, you have two types of operation:
Your task is to minimize the length of s by performing the above operations zero or more times.
Return an integer denoting the length of the minimized string.
Examples
Example 1
Input: s = "aaabc"
Output: 3
Explanation:
Example 2
Input: s = "cbbd"
Output: 3
Explanation:
Example 3
Input: s = "baadccab"
Output: 4
Explanation:
Constraints
1 <= s.length <= 100
s contains only lowercase English letters
Minimize String Length - Practice Coding | SlaveCode