I don't see how asking a potential software engineer to write a 30 line function in 30 minutes is bad. Being able to write code is part of the job description.
I don’t need to “prove” that I can write code by memorizing an algorithm. I have made more than enough code available on my GitHub which I’d be happy to explain in depth with anyone who is interested. Not interested? Great, you’ve made it easier for me to make my decision.
Depending on what those 30 lines are supposed to do and whether they have to be asymptotically optimal at doing it, writing down 30 lines of code while talking about every decision you’re making, to show the “thought process” might very well be more than a 30 minute task.