763 Partition Labels
763. Partition Labels
1. Question
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.
2. Implementation
(1) Two Pointers
3. Time & Space Complexity
Two Pointers: 时间复杂度O(n), 空间复杂度O(n)
Last updated