Class Solution

java.lang.Object
g0701_0800.s0763_partition_labels.Solution

public class Solution extends Object
763 - Partition Labels.<p>Medium</p> <p>You are given a string <code>s</code>. We want to partition the string into as many parts as possible so that each letter appears in at most one part.</p> <p>Return <em>a list of integers representing the size of these parts</em>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> s = &ldquo;ababcbacadefegdehijhklij&rdquo;</p> <p><strong>Output:</strong> [9,7,8]</p> <p><strong>Explanation:</strong></p> <pre><code> The partition is &quot;ababcbaca&quot;, &quot;defegde&quot;, &quot;hijhklij&quot;. This is a partition so that each letter appears in at most one part. A partition like &quot;ababcbacadefegde&quot;, &quot;hijhklij&quot; is incorrect, because it splits s into less parts. </code></pre> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> s = &ldquo;eccbbbbdec&rdquo;</p> <p><strong>Output:</strong> [10]</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= s.length <= 500</code></li> <li><code>s</code> consists of lowercase English letters.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details