diff --git a/dynamic_programming/word_break.cpp b/dynamic_programming/word_break.cpp index 5291f665f..2ec355a4b 100644 --- a/dynamic_programming/word_break.cpp +++ b/dynamic_programming/word_break.cpp @@ -105,7 +105,7 @@ bool check(const std::string &s, const std::unordered_set &strSet, // if the prefix till current position is present in the dictionary // and the remaining substring can also be segmented legally, then // set solution at position pos in the memo, and return true - if (exists(wordTillNow, strSet) and check(s, strSet, i + 1, dp)) { + if (exists(wordTillNow, strSet) && check(s, strSet, i + 1, dp)) { dp->at(pos) = 1; return true; }