I am one of those people who are extremely annoyed by "teacher questions". So I won't ever do it myself.

The approach I take as a "teacher", both here and in other forums, is first to look at how far off they are from a working solution. If I find they're pretty close, then I try to correct their problems, explaining why their solution doesn't work, and why mine does. It's my feeling that if they can learn just about the tiny details of what is wrong with their programs, then there's no need for them to come up with it for themselves. If there's too much wrong with it, then just this one teaching moment won't suffice.

What I don't do is just offer a totally unrelated solution. I might offer one alternative solution in addition to fixing the problems in what they came up with.

If they're too far off, the kind of people the OP was asking about in the root of this thread, then I just don't bother teaching. I might bother offering a working solution, but without bothering to explain much. In that case it's intended as much (or even more) as a solution to other people with the same kind of problem.