1/ Cho em hỏi từ khóa auto trong code này là gì ạ?.
2/ dòng code này là gán arr1 cho set resSet đúng không ạ?
std::set<std::string> resSet (arr1.begin(), arr1.end());
Mọi người giải thích giúp em với ạ. Em cảm ơn nhiều
std::vector<std::string> mergeStringArr(std::vector<std::string> arr1, std::vector<std::string> arr2)
{
std::set<std::string> resSet (arr1.begin(), arr1.end());
for (auto str : arr2)
{
auto search = resSet.find(str);
if (search != resSet.end()) // found
{
resSet.erase(search);
}
}
std::vector<std::string> res (resSet.begin(), resSet.end());
return res;
}