344. Reverse String

来源:互联网 发布:mysql statistics状态 编辑:程序博客网 时间:2024/06/13 11:41
class Solution {public:    string reverseString(string s) {        int n=s.size();        int i=0,j=n-1;        while(i<j)        {            swap(s[i],s[j]);            i++;            j--;        }        return s;    }};

0 0
原创粉丝点击