Personally I would have walked out if I got a negative vibe from the interviewer during this. Questions like this are deliberately obnoxious bullcrap pulled by recruiters and interviewers who don't understand what they're actually after in a candidate.
Everything that you want from a good software engineer (requirement refinement, minimal-effort-maximum-payout planning, awareness of a large variety of domains relevant to your company's business) was expressed by this person's response. You want these things in a candidate because they are the hardest things to find in a good candidate. But the interviewer didn't actually want real-world skills and a real problem solution, they wanted some arbitrary, bullcrap pseudocode up on the whiteboard. This kind of bullcrap pseudocode doesn't actually tell you if the person can or can't code, so it's utterly pointless.
I've walked out of interviews and refused job offers for less egregious examples of this kind of nonsense. It doesn't bode well for the company when they're so scatterbrained and insecure that they can't handle someone who actually takes your question seriously.