1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/划分字母区间 [partition-labels].html
2022-03-29 12:43:11 +08:00

24 lines
806 B
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>字符串 <code>S</code> 由小写字母组成。我们要把这个字符串划分为尽可能多的片段,同一字母最多出现在一个片段中。返回一个表示每个字符串片段的长度的列表。</p>
<p> </p>
<p><strong>示例:</strong></p>
<pre>
<strong>输入:</strong>S = "ababcbacadefegdehijhklij"
<strong>输出:</strong>[9,7,8]
<strong>解释:</strong>
划分结果为 "ababcbaca", "defegde", "hijhklij"。
每个字母最多出现在一个片段中。
像 "ababcbacadefegde", "hijhklij" 的划分是错误的,因为划分的片段数较少。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>S</code>的长度在<code>[1, 500]</code>之间。</li>
<li><code>S</code>只包含小写字母 <code>'a'</code><code>'z'</code></li>
</ul>