solution for Arrays chapter 1