These kind of questions is not to see how smart you are, it is to weed out all the ones who don't event get the most basic parts of programming. And I can assure you as someone doing a shitload of interviews, that a huge part of candidates doesn't understand the basics of programming such as sorting an array.
If all candidates had a minimum competence, sure we could do other kinds of things. But right now, you will first have to pass the "I can do newbie programming" tests.