Practice Partition String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Scan s from left to right while maintaining the set of previously emitted segments. Grow a current segment one character at a time; as soon as its string has not been emitted before, append it to the output, mark it as seen, and start a new segment at the next character. Return the emitted segments in order. If the input ends with a still-seen partial segment, do not emit that remainder; for example, aaaa produces [a, aa].
Source: Partition String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "abbccccd"
["a","b","bc","c","cc","d"]
# Example 2
s = "aaaa"
["a","aa"]
Constraints
Related LeetCode Problems
Practice more problems similar to Partition String .
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.