cacheMatrix solution