Solved cachematrix assignment