python online


  • 0
    class Solution(object):
        
        def reverseStr(self, s, k):
            """
            :type s: str
            :type k: int
            :rtype: str
            """
            return "".join([s[i:min(i+k,len(s))][::-1] if (i/k)%2==0 else s[i:min(i+k,len(s))] for i in range(0,len(s),k) ])
    

Log in to reply
 

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