Skip to content

Commit 7600e53

Browse files
authored
Create Saul.md
1 parent 0dc5611 commit 7600e53

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

2018.12.2-leetcode557/Saul.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
```java
2+
class Solution {
3+
public String reverseWords(String s) {
4+
String result = "";
5+
String[] words = s.split(" ");
6+
for(String word : words){
7+
char[] chars = word.toCharArray();
8+
int j = chars.length-1;
9+
for(int i =0;i<j;i++){
10+
char a = chars[i];
11+
chars[i] = chars[j];
12+
chars[j] = a;
13+
j--;
14+
}
15+
result += String.valueOf(chars)+" ";
16+
}
17+
return result.trim();
18+
}
19+
}

0 commit comments

Comments
 (0)