Skip to content

Commit 4a635fe

Browse files
authored
Merge pull request gzc426#185 from FFFro/master
2
2 parents a2f9fca + d5c6966 commit 4a635fe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

2018.11.28-leetcode151/FFFro.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class Solution {
2+
public String reverseWords(String s) {
3+
if(s == "")
4+
return "";
5+
String[] str = s.split(" ");
6+
String res = "";
7+
for (int i = str.length-1; i >=0; i--) {
8+
if(!str[i].equals("")){
9+
if (res.length()>0)
10+
res += " ";
11+
}
12+
res += str[i];
13+
}
14+
return res;
15+
}
16+
}

0 commit comments

Comments
 (0)