my one-line java solution


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

Log in to reply
 

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