fn play(input: &(Vec<Vec<char>>, Vec<[usize; 3]>), reverse: bool) -> String
Expand description
Rust’s borrow checker won’t allow us to mutate 2 nested vec
s simulataneously, so we need
to use an temporary intermediate vec
to store the moving crates. For efficiency we can re-use
the same vec to prevent unnecessary memory allocations.
A nice standard library feature is that we can collect an iterator of char
s into a String
for the final answer.