Partition labels by character occurrence
Your task
You are given a string s of lowercase English letters. Partition it into as many contiguous parts as possible so that each letter appears in at most one part. Return a list of the sizes of these parts, in left-to-right order. The string has length between 1 and 500.
Examples
partition_labels(s: str) -> list[int]Example 1
Input
partition_labels("ababcbacadefegdehijhklij")Output
[9, 7, 8]