Is it ethical to publish homework? Sometimes when doing course work for university, I'd like to write about it on my website, or publish it in its entirety, because I think that other people might be interested in it.

My goal is not to reach other students, but depending on the work, I think it's likely that they would easily find it when searching for it, and most courses reuse homework questions and paper topics over multiple years.

So my question is if it would be ethical for me to do so, and under which circumstances.


Does it depend on the task? Eg I would assume that it's not ok if it's a very specific task that only other students would be interested in, but ok if it's a general problem? 
Does it depend on length? What about simple homework questions vs page-long papers vs presentation slides vs thesis paper vs code?
Should I do something to conceal it? Eg change the paper title, remove any mention of the course and university name, not publish the homework question itself?


I'm mainly asking about the ethics of it, but if you know if it is generally legal or forbidden by universities, I would be interested in that as well.


In case it affects your answer: I'm studying computer science in Germany.
Sometimes when doing course work for university, I'd like to write
  about it on my website, or publish it in its entirety, because I think
  that other people might be interested in it.


This re-enforces your learning BUT will current students have access to it.

Once, a student from my University did this, and someone else copied from her. There was a big mess about this. Fortunately the student got a passing grade for the class.


  and most courses reuse homework questions and paper topics over
  multiple years.


and


  So my question is if it would be ethical for me to do so, and under
  which circumstances.


Instead of using exact question answer, can you create similar question and give solution. This way you are tutoring other people and making them think (and making yourself think), rather than giving the answers to students who just want to pass the class and forget what they "learned".