标签:col alt tor void 字符串 reverse rev style ++
题目:
解答:
1 class Solution { 2 public: 3 void reverseString(vector<char>& s) 4 { 5 if (s.size() <= 1) 6 { 7 return; 8 } 9 10 int beg = 0; 11 int end = s.size() - 1; 12 13 while (beg < end) 14 { 15 char tmp = s[beg]; 16 s[beg] = s[end]; 17 s[end] = tmp; 18 beg++; 19 end--; 20 } 21 } 22 };
标签:col alt tor void 字符串 reverse rev style ++
原文地址:https://www.cnblogs.com/ocpc/p/12823041.html