Add cacheSolve implementation