I used to be a party to walking through software engineering candidates through answering this question.
I answered it myself, as part of my own hiring process, with several other programmers there. Part of the prompt from them was to “think of us as your team, feel free to ask questions or get clarifications.”
That aspect is why I felt this particular “exercise” was legitimate. It was a good measure of how a person would work with the team.
Interviewing for software is a gigantic topic, and this only glances at the surface of it. But I’ve been fortunate to be part of workplaces that have valued me.