fileprivate func reverse<T>(_ chars: inout [T], _ start: Int, _ end: Int) {
var start = start, end = end
while start < end {
swap(&chars, start, end)
start += 1
end -= 1
}
}
fileprivate func swap<T>(_ chars: inout [T], _ p: Int, _ q: Int) {
(chars[p], chars[q]) = (chars[q], chars[p]) //请问,这一行该怎么理解?
}
1
GromHellscream OP |