Amazon Online Assessment (OA) - Partition String
Given a string S
of lowercase letters.
Partition S
into as many parts as possible so that one letter only appears in one part.
Input
The input consists of one argument:
S
: a string of lowercase letters
Output
Return the partitions as a list.
Examples
Example 1:
Input:
S = "bbeadcxede"
Output: ["bb", "eadcxede"]
Example 2:
Input:
S = "baddacx"
Output: ["b", "adda", "c", "x"]
Try it yourself
Got a question?ย Ask the Teaching Assistantย anything you don't understand.
Still not clear? Ask in the Forum, ย Discordย orย Submitย the part you don't understand to our editors.