projects
/
advent_of_code_2022.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cd53fdc
)
little simplification
author
Greg Burri
<greg.burri@gmail.com>
Mon, 12 Dec 2022 10:04:45 +0000
(11:04 +0100)
committer
Greg Burri
<greg.burri@gmail.com>
Mon, 12 Dec 2022 10:04:45 +0000
(11:04 +0100)
src/day12.rs
patch
|
blob
|
history
diff --git
a/src/day12.rs
b/src/day12.rs
index
ee08a24
..
fe30f0f
100644
(file)
--- a/
src/day12.rs
+++ b/
src/day12.rs
@@
-37,8
+37,7
@@
pub enum Path {
pub fn nb_steps(hm: &Heightmap, path: Path) -> i32 {
let (n, m) = (hm.elevations.len(), hm.elevations[0].len());
- let mut visited: Vec<Vec<i32>> = Vec::new();
- for _ in 0..n { visited.push(vec![-1; m]); }
+ let mut visited: Vec<Vec<i32>> = vec![vec![-1; m]; n];
let mut positions = vec![hm.end];
let mut next_positions = Vec::new();
let mut step = -1;