1 line java


  • 0
    S
    public String reverseWords(String s) {
            return Arrays.stream(s.split(" ")).map(w -> new StringBuffer(w).reverse().toString()).collect(Collectors.joining(" ")).toString();
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.