59ms Python


  • 0
    A
    class Solution(object):
        
        @staticmethod
        def rev(string):
            return string[::-1]
            
        def reverseWords(self, s):
            """
            :type s: str
            :rtype: str
            """
            return ' '.join([Solution.rev(i) for i in s.split()])
        
    

Log in to reply
 

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