But if you go up a few steps then suddenly the problems might not be that clearly defined and the set of possible solutions can be huge. A person who is constantly relying on Google to come up with solutions is probably not going to be that useful in design discussions.
I'm not defending the particular question, but on-your-feet problem solving is a real and valuable skill.
But then in that case, the problem as given is still bad, because it gives that part away! If you want to test this ability, you shouldn't frame the problem in terms of linked lists. As another poster here suggested, you should ask something like "The customer gave a list of everyone and who they report to. How would you sanity check the hierarchy?"
That then requires the candidate to identify cycles as something they'd want to look for, and then this problem as a special case of "find a cycle in a linked list".
For example, given the loop in linked lists question, even if a candidate is not able to solve it completely, a reasonable approach would be to break the general case to more specific, trivial cases, such as: what if the loop has known length, what if the loop starts at a known location, etc. Interview questions are not binary decisions, you can learn a lot from a candidate just by seeing how they respond to a question.
Point being, you're demonstrating initiative and, that old cliche, thinking outside the box. Think Will Smith in Men In Black.
Some interviewers might be impressed with your lateral thinking, others might be annoyed at your attempt to be a 'smart ass' and avoid the intention of the question. But that's always the problem with these type of interview questions, it depends so much on the expectations of the interviewer.
Maybe this points to a better class of interview questions: the interviewer supplies the broken algorithm, the interviewee supplies the bugfix.
I think that applies to junior positions, too.
It felt that they were interviewing for a computer scientist despite advertising for a software engineer.
Needless to say, we were mutually not a good fit.
>> Obviously it depends on the job I was interviewing for.
In my experience, it often does not depend on the job. Interviewers ask such things even if the job does not require it because ... ultimately because they are not good interviewers. If you get asked the question, the best bet is to just answer it or else the interview goes downhill from that point on.
Obviously it depends on the job I was interviewing for. Let's assume I'm not angling for a position as lead on a distributed load balancing layer or something.
I suppose if they're looking to see my problem solving workflow then I'd look like kindof a dick. But then, as the article points out, so would they.