Skip to content

Commit abe1aa5

Browse files
authored
Update synonymous-sentences.cpp
1 parent de2a1dd commit abe1aa5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

C++/synonymous-sentences.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ class Solution {
7777
}
7878

7979
string join(const vector<string>& strings, const string& delim) const {
80+
if (strings.empty()) {
81+
return "";
82+
}
8083
ostringstream imploded;
8184
copy(strings.begin(), prev(strings.end()), ostream_iterator<string>(imploded, delim.c_str()));
8285
return imploded.str() + *prev(strings.end());

0 commit comments

Comments
 (0)