【LeetCode】344. Reverse String


题目描述:

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

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


代码实现:

class Solution {
public:
    string reverseString(string s) {
        reverse(s.begin(),s.end());
        return s;
    }
};


 
comments powered by Disqus