solved exercise 11 from arrays