Skip to content

Commit

Permalink
2022_09: rust solution(part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
MellKam committed Dec 13, 2022
1 parent 8ba12e7 commit ee9a822
Show file tree
Hide file tree
Showing 7 changed files with 2,172 additions and 8 deletions.
15 changes: 8 additions & 7 deletions 2022/day_8/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ fn main() {
let data = include_str!("../../input.txt");

let grid = Grid::from(data);
// let grid_peak_ranges = GridPeakRanges::from(&grid);
let grid_peak_ranges = GridPeakRanges::from(&grid);

// let visibility_map = grid.get_visible_items_map(&grid_peak_ranges);
let visibility_map = grid.get_visible_items_map(&grid_peak_ranges);

// let sum = visibility_map
// .iter()
// .map(|row| row.iter().map(|&v| v as u32).sum::<u32>())
// .sum::<u32>();
let sum = visibility_map
.iter()
.map(|row| row.iter().map(|&v| v as u32).sum::<u32>())
.sum::<u32>();

let scenic_scores = grid.get_scenic_scores();
let max_scenic_score = scenic_scores.iter().max();

println!("{:#?}", max_scenic_score);
// println!("{sum}");
println!("{sum}");
}
Loading

0 comments on commit ee9a822

Please sign in to comment.