Partition Labels
You are given a string s of lowercase English letters. Partition it into as many parts as possible so that each letter appears in at most one part, and return a list of the size of each part.
A partition is valid only if no letter is split across two parts.
s = ababcbacadefegdehijhklij
[9, 7, 8]
The partition is "ababcbaca", "defegde", "hijhklij". Every letter stays inside a single part; splitting into more parts would break that.
s = eccbbbbdec
[10]
The last 'c' sits at the very end and 'e' recurs late too, so the whole string has to be one part.
- 1 <= s.length <= 500
- s consists of lowercase English letters only