Given a string s, partition it into as many parts as possible so that each letter appears in at most one part. Return a list of integers representing the size of these parts. Pattern focus: Local Choice Proof. For every character, extend the current partition until all occurrences of the current segment’s characters are contained within it.
s = input string
array of partition sizes
Example 1:
Input:
s = "ababcbacadefegdehijhklij"
Output:
[9,7,8]
Explanation:
This is the standard example; each character stays within exactly one partition.
Example 2:
Input:
s = "eccbbbbdec"
Output:
[10]
Explanation:
Every character overlaps with the rest, so the entire string is one partition.
Example 3:
Input:
s = "a"
Output:
[1]
Explanation:
A single character always forms a partition of length 1.