added solution for cachematrix exercise