Some of them couldn't even get nested for loops to work correctly.
If you're hiring someone to write code for you, you need to have them write code in the interview. There's no substitute for it.
Obviously, you can improve the experience - let them bring their own laptop and code on it, no problem.