Implementation for makeCacheMatrix and cacheSolve methods