easyHash TableString 0 views

Minimize String Length

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.

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.

Minimize String Length diagram

Example 1

Input: s = "aaabc"

Output: 3

Example 2

Input: s = "cbbd"

Output: 3

Example 3

Input: s = "baadccab"

Output: 4

Constraints

  • 1 <= s.length <= 100
  • s contains only lowercase English letters

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.