It’s testing for practiced solutions of memorized algorithms and a bit of role play.
I get there’s some IQ challenge to preparing this and it’s hard to evaluate skill, but I don’t think this tests much beyond that.
Want to test true basic programming capacity? Do fizz buzz, ask someone to reverse names in a string with loops - everyone should be able to do that without thinking.
That’s actual basic stuff.
High level or more complexity? Discuss a relevant problem the company needs to solve and how they’d approach it.
Better yet discuss a problem and debug it together. Most programming is debugging anyway.
And as the post you answered to alluded to, the point of the question is really just to filter out candidates who can't even write simple code, just like fizzbuzz. That's the kind of question you could ask in a first round, and then proceed to more relevant questions.
We really don't need True Scotsmans on this site.
To make my point clear, you can implement a dumb and inefficient sort by implementing a min function, taking this min, then iteratively call it on what's left of the array and append the values to a new array which you then return. That won't get you into FAANGM, but maybe that's enough to get some discussion started in an interview at a company that's not too much into leetcode and is trying to evaluate other skills like communication. And I do think that 99% of people who write code every week could come up with something like this or better fairly quickly.
The reason I jumped to quicksort in my initial reply is any sort short of quick or merge sort (or some other nlogn variant) would fail you at FAANG.
You could do the naive n^2, but it better only be in the first two min and hand waved off as obviously inefficient, almost a joke that you implemented it at all on the way to writing the nlogn version, bonus points if you talk about how merge sort is nlogn in worst case and quicksort is n squared in the worst case, but in practice often faster.
The more general problem is just how far removed from reality are all these questions. I once tried interviewing for Google, just for fun because they sent me an email about it. They asked me about quicksort, I said that I'm able to implement it in any language I know given an hour and the ability to google things. They were apparently not very satisfied with this response.
Why do you need to recite things from memory on the interviews while you'll be able to consult whatever the hell you want on your actual job? No one knows.
If you can't divide numbers, how will you ever do algebra?
Guess what? They're different skills.
A person who is good at algebra, may not be good at all at division. I know a few who fall into that category. The use a calculator.