Friday, September 19, 2014

Leetcode: Reverse Words in a String @Python

class Solution:
    # @param s, a string
    # @return a string
    def reverseWords(self, s):
        return " ".join(s.split()[::-1])

No comments :

Post a Comment