I wonder how much the context of being in an interview screws this up.
They might be able to solve it perfectly if encountered in the wild, but if you see it in an interview part of you is thinking “there’s got to be a trick to this that I’m not seeing”
Yeah, the first time I interviewed after working at the same place for over ten years I was totally thrown off, because I was expecting to have a discussion about my experience and not have to whiteboard a method to list all files in a directory.
They might be able to solve it perfectly if encountered in the wild, but if you see it in an interview part of you is thinking “there’s got to be a trick to this that I’m not seeing”