Python 1 Liner, bad coding example


  • 0
    V

    oh look at me im so smart i made a one liner. no, bad code.

    import re
    
    class Solution(object):
        def reverseWords(self, s):
            """
            :type s: str
            :rtype: str
            """
            return ' '.join(reversed(re.split(r"\s+", s.strip())))

Log in to reply
 

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