part a finished, passed all given test cases