The goal is to design a function similar to Python's split function but in this case we're splitting a given input string by ' '. However, the catch is, if there is a ' ' between quotes within the string then you must preserve it.
Example:
input_string = "foo hello 'hello world' blah"
output: ["foo", "hello", "hello world", "blah"]There are a couple edge cases the interviewer wanted me to consider:
I came up with a two pointer approach for this problem. Do you guys have any other solutions/suggestions?