It seems to me the best solution is already in your question. You say:
I guess perhaps the solution is to give the better solution (preferably first) and then give an answer including the restriction.
Excellent idea, and I will try to do that.
How else could we deal with it? We could also try to educate all new users to add a proviso that "This is homework. Answers that show how this could be addressed without the restrictions are welcome, but the accepted answer must include the restriction". LikewiseBut, this would be the same as the homework tag. Also, we could try to remind people to include both the restricted and unrestricted solution in their answers, but how many people on this site actually bother to read the guidelines for answering questions? Good luckAll you end up doing with either of these approaches is adding to the clutter, and increasing the amount of stuff that people have to remember when writing an answer. Probably neither of these is a good (or even remotely practical) idea.
Your point about the broader utility ofhow useful the question and answer are to the wider community is still valid, though:
But it still seems like the question is less than useful to anybody that isn't doing the exact same class with the exact same instructor.
WellIf that's right, yesthis is covered by the "too localized" tag.
Will all this said, butwe also need remember that there is a reason why students are asked these kind of questions with restrictions: to help them learn. And we can all continue to learn: I know I've picked up some brass among the muck on this site. So, I suggest therefore that theythese questions with odd restrictions aren't all completely useless, and we just need to look at them as the learning opportunities that they are.