Reverse Every Other Chunk — Solution & Editorial
Iterate in strides of 2K, reversing the [i, i+K) slice — slicing gracefully handles the ragged tail.
Complexity: O(|S|)
Iterate in strides of 2K, reversing the [i, i+K) slice — slicing gracefully handles the ragged tail.
Complexity: O(|S|)