Python,really easy to understand


  • 0
    Z
    def reverseStr(self, s, k):
        ss = ''
        for i in range(0,len(s),2*k):
            ss = ss+s[i:i+k][::-1]+s[i+k:i+2*k]
        return ss
    

Log in to reply
 

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