|
|
|
|
|
by unrealhoang
2014 days ago
|
|
> Can you tweak your function to stop filling the first time a zero is encountered? That's a simple one-line change with the for loop, but a puzzle for the functional iteration. In Rust: a.iter_mut().take_while(|i| *i == 0).for_each(|i| *i = 0)
And it's as fast as hand-written for loop. |
|