We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0b7f3fe + 92a5d00 commit 420729dCopy full SHA for 420729d
exercises/standard_library_types/arc1.rs
@@ -32,12 +32,7 @@ fn main() {
32
for offset in 0..8 {
33
let child_numbers = // TODO
34
joinhandles.push(thread::spawn(move || {
35
- let mut i = offset;
36
- let mut sum = 0;
37
- while i < child_numbers.len() {
38
- sum += child_numbers[i];
39
- i += 8;
40
- }
+ let sum: u32 = child_numbers.iter().filter(|n| *n % 8 == offset).sum();
41
println!("Sum of offset {} is {}", offset, sum);
42
}));
43
}
0 commit comments