Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    3597 - Partition String.

    Medium

    Given a string s, partition it into unique segments according to the following procedure:

    • Start building a segment beginning at index 0.

    • Continue extending the current segment character by character until the current segment has not been seen before.

    • Once the segment is unique, add it to your list of segments, mark it as seen, and begin a new segment from the next index.

    • Repeat until you reach the end of s.

    Return an array of strings segments, where segments[i] is the <code>i<sup>th</sup></code> segment created.

    Example 1:

    Input: s = "abbccccd"

    Output: "a","b","bc","c","cc","d"

    Explanation:

    Here is your table, converted from HTML to Markdown:

    Hence, the final output is ["a", "b", "bc", "c", "cc", "d"].

    Example 2:

    Input: s = "aaaa"

    Output: "a","aa"

    Explanation:

    Here is your table converted to Markdown:

    Hence, the final output is ["a", "aa"].

    Constraints:

    • <code>1 <= s.length <= 10<sup>5</sup></code>

    • s contains only lowercase English letters.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final List<String> partitionString(String s)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait