Given a string s, partition it into a sequence of unique segments using a greedy approach by processing each character from left to right:
Maintain a current segment, initially empty, and a list of recorded segments.
For each character in s, append it to the current segment.
If the current segment has not been seen before, append it to the list of recorded segments and reset the current segment to an empty string.
If the current segment has already been seen, keep it and proceed to the next character.
Return the list of unique segments generated by this process.
Constraints:
s.length
s contains only lowercase English letters.
Given a string s, partition it into a sequence of unique segments using a greedy approach by processing each character from left to right:
Maintain a current segment, initially empty, and a list of recorded segments.
For each character in s, append it to the current segment.
If the current segment has not been seen before, append it to the list of recorded segments and reset the current segment to an empty string.
If the current segment has already been seen, keep it and proceed to the next character.
Return the list of unique segments generated by this process.
Constraints:
s.length
s contains only lowercase English letters.