Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hsaikia committed Dec 7, 2024
1 parent 7d14790 commit cba80e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions src/bin/2024_02/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,11 @@ fn good_sequence<const PART: usize>(seq: &[usize]) -> bool {
}

fn solve<const PART: usize>(input: &str) -> usize {
let mut ans = 0;
for report in input.lines() {
let sequence = io::tokenize_nums(report, " ");
ans += if good_sequence::<PART>(&sequence) {
1
} else {
0
};
}
ans
input
.lines()
.map(|l| io::tokenize_nums(l, " "))
.filter(|v| good_sequence::<PART>(v))
.count()
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/2024_07/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn solve<const BASE: i32>(input: &str) -> usize {

fn main() {
let input = common::get_input();
println!("{input:?}");
// println!("{input:?}");
common::timed(&input, solve::<2>, true);
common::timed(&input, solve::<3>, false);
}
Expand Down

0 comments on commit cba80e9

Please sign in to comment.