porting over AOC from previous years to a monorepo.
This commit is contained in:
commit
84c4cf9991
194 changed files with 30104 additions and 0 deletions
20
2023/days/09/src/part1.rs
Normal file
20
2023/days/09/src/part1.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
use crate::parse::*;
|
||||
|
||||
pub fn part1(input: &[Vec<i32>]) -> i32 {
|
||||
input.iter().map(|l| extrapolate_sequence(l)).sum()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_part1() {
|
||||
let input = vec![
|
||||
vec![0, 3, 6, 9, 12, 15],
|
||||
vec![1, 3, 6, 10, 15, 21],
|
||||
vec![10, 13, 16, 21, 30, 45],
|
||||
];
|
||||
assert_eq!(part1(&input), 114);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue