Converted solution into an Array method.