标签:++ vector reverse pre public span size end ever
双指针反转
class Solution { public: void reverseString(vector<char>& s) { int start = 0; int end = s.size() - 1; while (start < end) { swap(s[start], s[end]); ++start; --end; } } };
LeetCode 344. 反转字符串 Reverse String
标签:++ vector reverse pre public span size end ever
原文地址:https://www.cnblogs.com/ZSY-blog/p/12989779.html