力扣链接:
https://leetcode-cn.com/probl...
解题思路:

  1. 翻转字符串这道题比较简单,使用两个指针,然后从首位开始遍历,交换首尾位置,循环直到首尾相遇
func reverseString(s []byte)  {
    n := len(s)
    low, high := 0, n-1
    for low <= high {
        s[low], s[high] = s[high], s[low]
        low++
        high--
    }
}

LabRat
1 声望1 粉丝