[LeetCode] Partition Labels 分割标签

Posted Grandyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Partition Labels 分割标签相关的知识,希望对你有一定的参考价值。

 

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.

 

Example 1:

Input: S = "ababcbacadefegdehijhklij"
Output: [9,7,8]
Explanation:
The partition is "ababcbaca", "defegde", "hijhklij".
This is a partition so that each letter appears in at most one part.
A partition like "ababcbacadefegde", "hijhklij" is incorrect, because it splits S into less parts.

 

Note:

  1. S will have length in range [1, 500].
  2. S will consist of lowercase letters (‘a‘ to ‘z‘) only.

 

s

 

以上是关于[LeetCode] Partition Labels 分割标签的主要内容,如果未能解决你的问题,请参考以下文章

*Leetcode 763. Partition Labels

LeetCode 663. Equal Tree Partition

LeetCode Array Partition I

LeetCode Partition Equal Subset Sum

Leetcode 86. Partition List

leetcode:Partition Array by odd and even