Why? Some prof worked hard to create the starter code for many assignments so the student could focus on a few key parts. After the student completes the few key parts of the assignment it is obvious it is a derivative work of the professor.
Also posting the solution online would obviously make it difficult to use for the next year and I don't think it is productive to make a professor remake an assignment every year when the could be focusing on refining lecture content.