You have to be incredibly lucky, or very experienced in this to ever get an interview coding exercise you look good in. Its incredibly stressful and usually gives the company a very weak signal of what you will they get as a dev.
There is soooo much setup in a modern dev process, build tools, compilers, transpilers, code formatting configs, let alone editors, languages and frameworks you are comfortable in, its not even funny.
You will be asking a candidate to understand a task completely without any prior knowledge, figure out whats the minimum setup they need to work on it successfully, implement the logic in very few iterations and no coding partners or knowledge repos to help them. Preferably with some testing setup, and to top it off you want them to do it in an hour.
As I mentioned it can be done if you are incredibly lucky and know exactly what to do, or have done this before many times in different interviews.
And what do you get in return?
Can a person work under high stress - e.g. are they ok at working in a shitty environment? If everything this should be a red flag as that person will keep shitty envs around and not go out of his way to fix things.
How good are his coding skills? Well not really, you will know that they can do interview tasks - e.g. a small bite sized problems that have easy solutions. Long term planing, refactoring, perseverance, etc. - no signal there.
And worst of all, it tells the candidate that your company/team enjoys high stress, small problem, and making each other uncomfortable. Remember an interview is both ways, and you just earned yourself a red flag too.
Btw, Adam Grant had some podcast episodes about interviewing last year that were really good and showed some companies that actually solve this in a very nice, humane _and effective_ way.