Word ladder: Difference between revisions

Content added Content deleted
(Added C++ solution)
m (C++ bug fix)
Line 84: Line 84:
return true;
return true;
}
}
auto i = std::remove_if(poss.begin(), poss.end(),
poss.erase(std::remove_if(poss.begin(), poss.end(),
[&next](const std::string& str) {
[&next](const std::string& str) {
return contains(next, str);
return contains(next, str);
});
}),
if (i != poss.end())
poss.end());
poss.erase(i);
for (const auto& str : next) {
for (const auto& str : next) {
std::vector<std::string> temp(curr);
std::vector<std::string> temp(curr);