A classically terrible interview question. Solving riddles in realtime is almost never a real job skill. _Maybe_ in an incident, but you’d be relying on tooling and experience, not an intern.
Same with leetcode at startups. It makes no sense. You’re almost certainly not going to do algorithms work. It’s only relevant if you’re looking for people willing to grind bullshit, which is certainly some jobs, but, again, you’re almost never doing this under arbitrary time pressure with someone watching over your shoulder judging and not helping.
My advice: if you encounter this, don’t work there. If a company doesn’t value testing relevant skills for candidates, don’t expect leadership to be strong critical thinkers once you get there.
This was an internship interview over a decade ago. Nothing wrong with a brain teaser interview question under those circumstances. What would you rather ask an internship candidate? They don’t have work experience or real world skills.
Classical algorithms kind of thinking is similar to ML research.
The speed with which I can remember some obscure AIX partitioning-related fact during an incident, for example, is orders of magnitude faster than the speed with which I would figure out which of 12 marbles is slightly heavier than the others.