Function cacheSolve improvement