Surprised by new requirements presented mid-implementation
Summary
I recently interviewed with Meta and encountered a novel experience during a coding interview where new requirements were presented mid-implementation for a problem involving balancing parentheses while preserving the meaning of an arithmetic expression.
Full Experience
I was recently interviewing with Meta and had a novel experience during a coding interview.
The interviewer gave me a relatively straightforward problem, remove parentheses from a string so the remaining parentheses are balanced.
I got about half way through implementing a solution and the interviewer interrupted me to ask what the code I had written so far would do with a particular example input. I did a quick verbal walkthrough of which parentheses it would remove and why and showed the results would be balanced. Then the interviewer said that those results would change the meaning of the string if the non-parentheses characters were considered to be an arithmetic expression, and I needed to keep that meaning.
I'm no stranger to having new requirements added in a coding interview, but I'm used to it coming at the end. The usual process is to set and solve an easy problem, then add a new constraint to make it harder and modify the solution to satisfy the new constrait. This interview with the new constraint coming in the middle was a novel experience for me.
What made it problematic is that the interviewer didn't present it as a new constraint. At no point did he acknowledge that this constraint wasn't present in the original problem or demonstrated by any of the given examples. And he didn't seem interested in seeing me finish solving the original problem. I was a bit flustered, and it took me maybe a minute to figure out what the new constraint really meant. I did end up solving the problem with the new constraint, but I think I gave a bad impression in the middle while I was dealing with the change.
So, anyway, the moral of the story is to be ready for this experience, and don't let it throw you off like it did me.
Interview Questions (1)
The interviewer initially presented a problem: remove parentheses from a string so the remaining parentheses are balanced. Mid-implementation, an additional constraint was introduced: if the non-parentheses characters are considered an arithmetic expression, their meaning must be preserved after removing parentheses.