I've been doing this for 15+ years professionally, have a master's in CS and I struggled to answer many questions. Just stood there blinking like a goldfish.
If companies really wanted to simulate programming work, you'd give me 10-30 minutes to Google the problem because THAT'S HOW IT WORKS IN REAL LIFE. Which is how it should be; rarely are you solving a new problem, usually other people have faced it before, it's probably far more efficient to start with a known working solution and iterate from there.
Look, of course there things you should know. Data structures, algorithm basics, some complexity theory, etc. But asking me to output numbers in a matrix in a spiral fashion does not translate into real-world ability.
I find the more important developer skills are people skills and project management skills. How well do you work with others? How do you resolve conflicts? What's your methodology for grouping work-- Jira tickets, sprints, etc?
But almost none of the interviewers seemed to care. They wanted to know what exotic technology skills I had, not that I could work with project managers and marketers effectively.
Take-home projects are more time-consuming but the least unfair, whereas whiteboard coding is the shortest but most unfair.
I blame Google for this curse. I hope the next time I go looking for a job this process has changed.