added cacheSolve implementation