4 solution I see python


  • 0
    Y

    '''
    class Solution(object):
    solution 1
    l = len(s)
    if l < 2:
    return s
    return self.reverseString(s[l/2:]) + self.reverseString(s[:l/2])
    solution 2
    # r = list(s)
    # i, j = 0, len(r) - 1
    # while i < j:
    # r[i], r[j] = r[j], r[i]
    # i += 1
    # j -= 1
    # return "".join(r)
    solution 3
    # return s[::-1]
    solution 4
    # return "".join(reversed(list(s)))
    '''


Log in to reply
 

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