763. Partition Labels

Practice Partition Labels for free on NudgeCode: Medium, Greedy pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Cut s into as many pieces as possible so that each letter appears in only one piece. Return the lengths of the pieces, in order.

Example

s = "ababcbacadefegdehijhklij"  ->  [9,7,8]
s = "eccbbbbdec"                ->  [10]

Constraints