Earlier quoted context omitted.
Your problem actually is a good illustration of the whiteboard test problems. I just tried it, and it was trivial to do in a minute or two on my laptop. However, I did took note of two syntax mistakes that I made in the python REPL that were immediately obvious there and took seconds to fix, but which I most likely would not have noticed on a whiteboard. So there's quite a bunch of problems where if the acceptable "f…
Nobody is punishing trivial syntax errors in whiteboard interviews. Nobody is taking your code and checking it runs. It’s about your approach to problem solving and your ability to communicate that.
1. https://www.programmercoach.com/2017/04/interview-insider-co...