Partition Labels

You are given a string s. The task is to partition the string into as many parts as possible so that each letter appears in at most one part. The partition is done such that after concatenating all the parts in order, the resultant string should be s. Return a list of integers representing the size of these parts.

Constraints

  • 1 <= s.length <= 500
  • s consists of lowercase English letters.
Saving… · 2 lines
class Solution:
def partitionLabels(self, s: str) -> List[int]:
Console

Click Run to execute sample tests.