Skip to content

Commit e79366d

Browse files
committed
Time: 12 ms (55.24%), Space: 51.9 MB (40.96%) - LeetHub
1 parent 27fa3bf commit e79366d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

557-reverse-words-in-a-string-iii/557-reverse-words-in-a-string-iii.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public String reverseWords(String s) {
1313
reversedWordSP.append(wordSp.toString()+ " ");
1414
}
1515

16+
reversedWordSP.setLength(reversedWordSP.length() -1);
1617

17-
return reversedWordSP.toString().trim();
18+
return reversedWordSP.toString();
1819
}
1920
}

0 commit comments

Comments
 (0)