Mark
Whiteboard interview is nonsense. Especially for developers. Are you nervous when you have to speak in front of others? Did you forget everything on the stage instantly? Good. It doesn't matter because you are a developer and you aren't a manager. Most of the best devs I ever knew were very introvert and I bet they would fail on any whiteboard test too.
I don't get it why companies still asks same old algorithm questions. They are mostly related with algebra and don't help with understanding candidate's software design capabilities. I wouldn't hire a candidate who cracks the coding interview but writes lots of unmaintainable, conditional flooded code.
I think your answer is technically correct. The request was space complexity ˋO(n)ˋ, which does not mean in-place.
I think these kinds of questions get much harder than they really are when you're nervous, under time constraints, and using a ridiculous medium for coding like a whiteboard.
I had the problem too. I was asked for a data structure that (these requirements were impicit in a use case that I won't repeat)
I figured it out fairly easily on the train ride home afterwards, but that's a little late...