Unless your job is coding novel algorithm implementations under strict deadlines without a computer, how does answering this question in a job interview prove or disprove your efficacy in the actual position? It only proves you're good at interviewing, which, if you think about it, is not a desirable skill in your new hire 6-12 months down the road.
I see it as an IQ test. Official IQ tests are illegal for hiring of course. So they use algorithms instead. Not justifying it, but that’s the only logical answer I can think of.