summaryrefslogtreecommitdiff
path: root/day1/src
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-12-05 19:46:06 +0100
committerSanto Cariotti <santo@dcariotti.me>2022-12-05 19:46:06 +0100
commitcf6303a5bc1558ebdb7b467da38f74cd3ac3a9b1 (patch)
tree6292cb239a8cf114179c6e7c8b3015840dfbae6e /day1/src
parent6e10cc2773fcaff64902b13f44443da014f38be7 (diff)
Add 2022
Diffstat (limited to 'day1/src')
-rw-r--r--day1/src/main.rs21
1 files changed, 0 insertions, 21 deletions
diff --git a/day1/src/main.rs b/day1/src/main.rs
deleted file mode 100644
index 7e18b94..0000000
--- a/day1/src/main.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-use std::fs::File;
-use std::io::prelude::*;
-use std::io::BufReader;
-
-fn main() {
- let file = File::open("input.txt").expect("File not found");
- let reader = BufReader::new(file);
- let values: Vec<i32> = reader
- .lines()
- .map(|x| x.unwrap().parse::<i32>().unwrap())
- .collect::<Vec<i32>>();
- let mut increasing: u16 = 0;
-
- for index in 1..values.len() {
- if values[index - 1] < values[index] {
- increasing += 1;
- }
- }
-
- println!("{}", increasing);
-}