Used an array to get to solution