Given a string s, partition it into unique segments according to the following procedure:
Return an array of strings segments, where segments[i] is the ith segment created.
Examples
Example 1
Input: s = "abbccccd"
Output: ["a","b","bc","c","cc","d"]
Explanation:
Hence, the final output is ["a", "b", "bc", "c", "cc", "d"] .
Example 2
Input: s = "aaaa"
Output: ["a","aa"]
Explanation:
Hence, the final output is ["a", "aa"] .
Constraints
1 <= s.length <= 105
s contains only lowercase English letters.
3597. Partition String
Medium
30 Points
Hash Table
String
Trie
Simulation
Given a string s, partition it into unique segments according to the following procedure:
Return an array of strings segments, where segments[i] is the ith segment created.
Examples
Example 1
Input: s = "abbccccd"
Output: ["a","b","bc","c","cc","d"]
Explanation:
Hence, the final output is ["a", "b", "bc", "c", "cc", "d"] .
Example 2
Input: s = "aaaa"
Output: ["a","aa"]
Explanation:
Hence, the final output is ["a", "aa"] .