Python : 1 Line list comprehension


  • 0
    J
    def reverseStr(s, k):
      return ''.join([ s[i : i + k][::-1] + s[ i + k : i + 2 * k] for i in range(0, len(s), 2 * k) ])
    

Log in to reply
 

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