Loading RustViz Engine...
Reverse an array in-place without heap allocations using mutable pointers.
This problem is currently in blueprint template mode. Once the concept foundation is finalized, live in-browser WebAssembly compilation and test assertion runners will be enabled here.
pub fn reverse_in_place<T>(slice: &mut [T]) {
let mut i = 0;
let mut j = slice.len().saturating_sub(1);
while i < j {
slice.swap(i, j);
i += 1;
j -= 1;
}
}