added cacheSolve funcation