Added my attempt at the problem.