/**
* @param {character[]} s
* @return {void} Do not return anything, modify s in-place instead.
*/
var reverseString = function(s) {
let start=0;
let end=s.length-1;
while(start<end){
[s[start],s[end]]=[s[end],s[start]];
start++;
end--;
}
return s;
};
【leetcode】反转字符串
最新推荐文章于 2024-11-12 10:59:16 发布