added solution to array reverse