题解 | #反转字符串# go + 双指针
反转字符串
http://www.nowcoder.com/practice/c3a6afee325e472386a1c4eb1ef987f3
go + 双指针
func solve( str string ) string {
// write code here
if len(str) == 0 {
return ""
}
i, j := 0, len(str)-1
bs := []byte(str)
for ; i< j; i, j = i+1, j-1 {
bs[i], bs[j] = bs[j], bs[i]
}
return string(bs)
}