Coursera Algorithm1 Homework2