MCPcopy
hub / github.com/qiyuangong/leetcode / reverseWords

Method reverseWords

java/557_Reverse_Words_in_a_String_III.java:2–8  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

1public class Solution {
2 public String reverseWords(String s) {
3 String words[] = s.split(" ");
4 StringBuilder ans = new StringBuilder();
5 for (String word: words)
6 ans.append(new StringBuffer(word).reverse().toString() + " ");
7 return ans.toString().trim();
8 }
9}

Callers

nothing calls this directly

Calls 1

reverseMethod · 0.45

Tested by

no test coverage detected