mediumCountingHash TableString 0 views

Minimum Length of String After Operations

You are given a string s.

You are given a string s.

You can perform the following process on s any number of times:

Return the minimum length of the final string s that you can achieve.

Minimum Length of String After Operations diagram

Example 1

Input: s = "abaacbcbb"

Output: 5

Explanation: We do the following operations:

Example 2

Input: s = "aa"

Output: 2

Explanation: We cannot perform any operations, so we return the length of the original string.

Constraints

  • 1 <= s.length <= 2 * 10^5
  • s consists only of lowercase English letters.

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.