Easy Understanding Python


  • 0
    Z

    """

        def reverseStr(self, s, k):
            def reverse(string):
                return string[::-1]
            length = len(s)
            if k > length:
                return reverse(s)
            elif k < length and 2 * k > length:
                return reverse(s[:k]) + s[k:]
            else:
                return reverse(s[:k]) + s[k:2 * k] + self.reverseStr(s[2 * k:], k)
    

    """


Log in to reply
 

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