Homework 2 Solutions

This fails some of the test cases. Did you not compile and run it to test?