C# solution with LINQ


  • 0
    A

    The runtime is not fast, ~135 ms. It's probably the shortest C# solution.

    public string ReverseWords(string s) {
            return string.Join(" ",
                    s.Split(' ')
                    .Select(str => new String(str.Reverse().ToArray())));
        }
    

Log in to reply
 

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