Leetcode: Reverse String

Reverse String



Similar Problems:


Write a function that takes a string as input and returns the string reversed.

Example:
Given s = “hello”, return “olleh”.

Github: code.dennyzhang.com

Credits To: leetcode.com

Leave me comments, if you have better ways to solve.


## Blog link: https://code.dennyzhang.com/reverse-string
class Solution(object):
    def reverseString(self, s):
        """
        :type s: str
        :rtype: str
        """
        return s[::-1]
linkedin
github
slack

Share It, If You Like It.

Leave a Reply

Your email address will not be published.