Given a string
s
, partition the string into one or more substrings such that the characters in each substring are unique. That is, no letter appears in a single substring more than once.
Return the minimum number of substrings in such a partition.
Note that each character should belong to exactly one substring in a partition.
Constraints:
1 <= s.length <= 105
s
consists of only English lowercase letters.
給一字串
s
,將該字串切割為一段或是多段的子字串,且每段子字串中的字母都得是唯一的。也就是說,任意一個子字串中,不會有字母出現超過一次。
回傳分割後子字串數量的最小值。
注意,在一個合理的分割後每個字元都應該剛好屬於一個子字串
限制:
1 <= s.length <= 105
s
只會包含小寫的英文字母
LeetCode
C++