Reverse String
Example 1:
Input: s = ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]Example 2:
Input: s = ["H","a","n","n","a","h"]
Output: ["h","a","n","n","a","H"]Cheklovlar:
func reverseString(s []byte) {
n := len(s)
for i := 0; i < n/2; i++ {
s[i], s[n-1-i] = s[n-1-i], s[i]
}
}Last updated