APIs shouldn't be copyrightable as they're necessary for interfacing. The solution to a homework problem shouldn't be a derivative work of the problem, and so it should be possible to distribute the solution in a way that doesn't infringe on the university's copyright.
I don't think you can claim that changing code absolves you of copyright issues, it might make it harder to find though.