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.