Implemented function cacheSolve