File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change 12
12
*/
13
13
public class _557 {
14
14
15
- public String reverseWords (String s ) {
16
- StringBuilder stringBuilder = new StringBuilder ();
17
- StringBuilder sbUtils = new StringBuilder ();
18
- for (String word : s .split (" " )) {
19
- sbUtils .setLength (0 );
20
- sbUtils .append (word );
21
- stringBuilder .append (sbUtils .reverse ().toString ());
22
- stringBuilder .append (" " );
15
+ public static class Solution1 {
16
+ public String reverseWords (String s ) {
17
+ StringBuilder stringBuilder = new StringBuilder ();
18
+ StringBuilder sbUtils = new StringBuilder ();
19
+ for (String word : s .split (" " )) {
20
+ sbUtils .setLength (0 );
21
+ sbUtils .append (word );
22
+ stringBuilder .append (sbUtils .reverse ().toString ());
23
+ stringBuilder .append (" " );
24
+ }
25
+ stringBuilder .setLength (stringBuilder .length () - 1 );
26
+ return stringBuilder .toString ();
23
27
}
24
- stringBuilder .setLength (stringBuilder .length () - 1 );
25
- return stringBuilder .toString ();
26
28
}
27
-
28
29
}
You can’t perform that action at this time.
0 commit comments