There are a couple of things at play here:
1. I'm regularly complimented on how sharp my mind is, but I can't reliably recruit that sharpness on-demand. If I get any kind of brain fog during a timed problem (with no opportunity for a break), it's game over.
2. Coding in an unfamiliar environment, like Coderpad.
The problems are hard enough to make them easy to fail if you can't spot a good approach immediately, but easy enough that a "good" answer gives very little signal relative to the time being dedicated to the problem. I've done interview processes where 50% of the total process is given over to these kinds of problems, and the process concluded with me feeling I didn't get any real opportunity to demonstrate my strengths.
- interviews are inherently more stressful than even a very busy day at work, - they cover topics unrelated to what you'd do as part of your job so if you're good at the job you might still fail the interview - people with time (==money) to prepare for interviews will come out ahead of those who don't have that luxury, despite the fact they may be far better prepared for the actual job.
So you get a bunch of false positives, a bunch of false negatives, and on top of that you're discriminating against people who are in a worse financial situation or have interview anxiety. I can hardly think of a worse outcome for a seemingly sensible hiring method.
I’ve seen so many people over the years do terrible on these types of test that went on to be amazing contributors. We only found this out because we essentially ignored the outcome of these tests, which makes you wonder why you’re doing these tests at all!
That doesn't mean that someone would be unable to program it. Inverting a binary tree tests if you know how to traverse a tree. I may not traverse trees all day at work, but I can easily do a tree traversal if I needed to and I expect that to be true of most people who can actually program and not just talk the talk.
If you really really care about me traversing a graph, leave me alone with the task for a while, let me take my time, give me access to the internet even. Why do you care that I can write it on the spot? If anything that just proves that I memorised it just before the interview, not that I actually had to think much about it