reverse to make indices more readable
This commit is contained in:
parent
2b7b34eb1f
commit
f1001ef8ff
|
@ -28,9 +28,7 @@ fn main() -> Result<(), &'static str> {
|
||||||
.map(Monkey::item_count)
|
.map(Monkey::item_count)
|
||||||
.collect();
|
.collect();
|
||||||
item_counts.sort();
|
item_counts.sort();
|
||||||
println!(
|
item_counts.reverse();
|
||||||
"{}",
|
println!("{}", item_counts[0] * item_counts[1]);
|
||||||
item_counts[item_counts.len() - 1] * item_counts[item_counts.len() - 2]
|
|
||||||
);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,7 @@ fn main() -> Result<(), &'static str> {
|
||||||
.map(Monkey::item_count)
|
.map(Monkey::item_count)
|
||||||
.collect();
|
.collect();
|
||||||
item_counts.sort();
|
item_counts.sort();
|
||||||
println!(
|
item_counts.reverse();
|
||||||
"{}",
|
println!("{}", item_counts[0] * item_counts[1]);
|
||||||
item_counts[item_counts.len() - 1] * item_counts[item_counts.len() - 2]
|
|
||||||
);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue