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;
    }
};
posted @ 2018-12-03 21:42  A-Little-Nut  阅读(96)  评论(0编辑  收藏  举报