Java in one line


  • 0
    E
        public String reverseWords(String s) {
            return Arrays.stream(s.split(" ")).map(word -> new StringBuilder(word).reverse().toString()).reduce((s1, s2) -> s1 + " " + s2).get();
    
        }```

Log in to reply
 

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