Doing interviews (as an interviewer) greatly reduced my impostor syndrome as a junior software engineer.
When a guy interviewed with 10+ years of "experience" couldn't write a for loop was eye opening.
I work really bad under pressure and don't like memorizing algorithms. I hate programming anything complex on a whiteboard or anyway on-site.
Simple stuff, like your example is fine. It's a good way to weed out charlatans. A few points what I consider a good test:
* No previous algorithm knowledge required.
* No ticks.
* An average candidate should finish it in 5 minutes. (So we gave them 10 mins)
* It can be written in 10-15 lines.
* Pseudocode is fine