763. Partition Labels 分割標籤
❀ Origin
Problem
A string S of lowercase letters is given.
We want to partition this string into as many parts as possible so that each letter appears in at most one part,
and return a list of integers representing the size of these parts.
Note
Swill have length in range[1, 500].Swill consist of lowercase letters ('a'to'z') only.
Example 1
1 | Input: S = "ababcbacadefegdehijhklij" |
❀ 翻譯
問題
給定一個小寫字母的字串 S .
我們想要將此字串盡可能地分成多個部分, 以便每個字母最多只會重覆在一個部分,
並回傳一個代表著每個部份的長度整數的陣列.
注意
S的長度會介於[1, 500].S只會由小寫字母 ('a'to'z') 來組成.
❀ Solution
JavaScript
1 | /** |