Partition Labels
Problem statement
Split text into as many nonempty contiguous parts as possible so each distinct character appears in at most one part. Return the part lengths from left to right.
Function
partitionLabels(text: String) → int[]Examples
Example 1
text = "abcabcabdefffedgijhkij"return = [8,7,1,6]The maximal parts are abcabcab, defffed, g, and ijhkij.
Constraints
0 <= text.length <= 10^5.- The text contains lowercase English letters.