讨论/《腾讯》 - 反转字符串/
《腾讯》 - 反转字符串
共 2 个回复
var reverseString = function(s) {
    if (!s || s.length <= 1) {
        return
    }

    let findex = 0, lindex = s.length - 1
    while (findex < lindex) {
        const temp = s[lindex]
        s[lindex] = s[findex]
        s[findex] = temp
        findex ++
        lindex --
    }

};
class Solution:
    def reverseString(self, s: List[str]) -> None:
        """
        Do not return anything, modify s in-place instead.
        """
        s.reverse()

索然无味