LeetCode 344. Reverse String

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

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

分析

Easy

class Solution {
public:
    string reverseString(string s) {
        reverse(s.begin(),s.end());
        return s;
    }
};
原文地址:https://www.cnblogs.com/A-Little-Nut/p/10061125.html