Partition a string so each letter appears in at most one part. Return the sizes of the parts. Maximize the number of parts.
Greedy: find the last occurrence of each character. Scan left to right, extending the current partition's end to include all last occurrences.
💡 Pro tip: Understand this problem deeply — don't just memorize the code. Try explaining the approach out loud as if teaching a friend. If you can explain it simply, you truly understand it!
partitionLabels('ababcbacadefegdehijhklij')
[9, 7, 8]