763 Partition Labels
Last updated
Was this helpful?
Last updated
Was this helpful?
A stringS
of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representing the size of these parts.
Example 1:
Note:
S
will have length in range[1, 500]
.
S
will consist of lowercase letters ('a'
to'z'
) only.
(1) Two Pointers
Two Pointers: 时间复杂度O(n), 空间复杂度O(n)