Skip to content

344. Reverse String

https://leetcode.com/problems/reverse-string/

js
/**
 * @param {string} s
 * @return {string}
 */
var reverseString = function(s) {
  return s.split('').reverse().join('')
}
py
class Solution:

    def reverseString(self, s):
        """
        :type s: str
        :rtype: str
        """
        return s[::-1]