Sadly I've seen this kind of interviewing from lots of places; maybe it's a technique they teach in college or something.
Interview questions like this are useless as they are not an accurate approximation of a real work scenario. I've frozen up at a whiteboard in an interview before, and then figured it out on the drive home.
The best approach I've found is to do a send home quiz, and then ask them questions about the quiz to test understanding. The test also shows coding habits, which tells you a lot right there.
Bonus: put some typos in the quiz that don't matter. Red flag for the people that get hung up on that.
Please no. No and home quizzes
An accurate approximation of a real work scenario would be sitting in a conference room for two hours while trying not to fidget or visibly look bored as co-workers make a mountain out of a molehill.