It's something I'd expected someone to know in anything related to data science / machine learning / big data. But if it wasn't a position specific to those fields, then yeah that's that a pretty silly riddle of a question.
edit: even within those fields, it's definitely more of a very-specific-domain-knowledge type of question and not something that I think is worth the time to ask it in a job interview.
This is a common thing to learn during your first week or so in an introductory computer science course. They were probably picking something that a second-year student could use to easily demonstrate basic coding ability. Unfortunately, this didn't happen to be part of your intro course.
I didn't get it at the time and I deeply resented the problem. What does this have to do with being a software engineer?
But interesting to see how it's actually done.