cacheSolve first implementation