Simple solution in Python


  • 0
    J
    class Solution(object):
        def reverseString(self, s):
            """
            :type s: str
            :rtype: str
            """
            s = list(s)
            for i in range(len(s)/2):
                s[i], s[len(s)-i-1] = s[len(s)-i-1], s[i]
            return ''.join(s)
    

Log in to reply
 

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