Implemented the cacheSolve function