763. Partition Labels
Description
You are given a string s
. We want to partition the string into as many parts as possible so that each letter appears in at most one part.
Note that the partition is done so 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.
Example 1:
1 | Input: s = "ababcbacadefegdehijhklij" |
Example 2:
1 | Input: s = "eccbbbbdec" |
Constraints:
1 <= s.length <= 500
s
consists of lowercase English letters.
Hints/Notes
- 2025/01/03
- jump game
- 0x3F’s solution
Solution
Language: C++
Solution from 0x3F, it’s like merging intervals(56) or jump game(55)
1 | class Solution { |