Show my short python solution


  • 0
    C
    def convert(self, s, L):
        ans = ""
        for i in xrange(L):
            it = plus = i
            while it < len(s):
                if plus < L / 2 or (i != 0 and i != L - 1):
                    plus = L - 1 - plus
                ans += s[it]
                it += 2 * plus if L > 1 else 1
        return ans

Log in to reply
 

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