mediumCountingHash TableString 0 views

Minimum Length of Anagram Concatenation

You are given a string s, which is known to be a concatenation of anagrams of some string t.

You are given a string s, which is known to be a concatenation of anagrams of some string t.

Return the minimum possible length of the string t.

An anagram is formed by rearranging the letters of a string. For example, "aab", "aba", and, "baa" are anagrams of "aab".

Minimum Length of Anagram Concatenation diagram

Example 1

Input: s = "abba"

Output: 2

Explanation: One possible string t could be "ba" .

Example 2

Input: s = "cdef"

Output: 4

Explanation: One possible string t could be "cdef" , notice that t can be equal to s .

Example 3

Input: s = "abcbcacabbaccba"

Output: 3

Constraints

  • 1 <= s.length <= 10^5
  • s consist 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.