344. 反转字符串
class Solution {
public:
void reverseString(vector
<char>& s
) {
if(s
.size()==0) return;
int start
=0,end
=s
.size()-1;
char temp
;
while(start
<end
){
temp
=s
[start
];
s
[start
]=s
[end
];
s
[end
]=temp
;
start
++;
end
--;
}
}
};
转载请注明原文地址:https://blackberry.8miu.com/read-42789.html