1
0

Almost done haha

This commit is contained in:
Pcornat 2022-12-05 20:23:57 +01:00
parent 10b594e479
commit f4d2d3bf24
Signed by: Pcornat
GPG Key ID: 2F3932FF46D9ECA0
4 changed files with 327 additions and 4 deletions

300
prob3_part1.txt Normal file
View File

@ -0,0 +1,300 @@
zBBtHnnHtwwHplmlRlzPLCpp
vvhJccJFGFcNsdNNJbhJsJQplQMRLQMlfdfTPCLfQQCT
GPhjcjhZDjWtnSVH
BNhHVhrGNVTbDHdDJdJRPJdSQQSJwPjR
lvtsfbsqzwSnJcvjSm
MftttFLftZMLgtgMbltMqZzbDNrTpVGhNWrDTrpTGNpZGZhD
VSSHcTgTtTdtllZlzmmbljTn
RqMqsFfQLLFLQFMMfRLPZLvPpCfWrbpmCbjCnfjlWmnrmmnm
hqRDqPDRsqNHwtHSNBZtJd
tNFDpDFrtdjfmjjjFmFFdScpZhZScTJgpHccHhMJgS
lLzSlSCQqbsVhBghggBZgCcJ
zRLVVLQnvQqVVzRldfWrwffjjdwSdfjv
bpWqqqWvHBpwGBCCRl
hJdjdJFQqdBBDMMC
tFFzJZFtJSqtZJQsWLbNSTnffHfvTH
lFhRZhFjPlqMlJqZJlJcRLwrLrwStRwtsVVtVSrgRV
WcpDvDfBmpDHzWBDbpbmWmNVSSTzLTtrVswgttVVzwwr
pbWfmGBpHfDmWnvvGbmWnjjMqPJMlMFPdGcjqPqPhP
NjFNRlpVLFCSSlbBWWfw
pssPZQQsMnzmtnQPttzDBbBJBcrrJWbrZSBJSbfC
QTHPHspMNGHdhvRR
QfPdSJfFJmthSthtwbsNLbPLlLTLpbvP
nHnMBnZqqgBMnWrZMqnZVcbCqRwNsvblRwppbllTsRNp
nZHBHznMnWgcrnVBtjFdfmzQNtNddjNF
hFhfPghppPhpRNhzsjsvHVzjpsGnWz
tTjlCCwMqtdMjMctGJWHwWnVwWnwvWGs
rZdrjBBtqdCtlcdgFZQLfhRLFSgRNP
RDHSWrJWffJFlJCgCMCDjCvzjPMP
QtGTndBw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lmqq
JvJCzBDJwnsRnQDszCBnnnQBrjZPjFpgZFTFZRpTrpZFGFtT
wBHQQZHVCcpwDgdZdMsZjvMZFn
GPSzlNlJLfzzzvsWdWLMmFWLMM
NfqGSfrTNzRTqJfRbptQHFQFrwrFHBHw
sNjVMVNVMzPzQgghcMsNzJtjSJtTFDTJtJnnDLjDnL
CHwrdCpvCrwrWdpZqcpFttJSFJTLLHLJfbnbfD
qrlZCwlqZrqqpWdlRqCRqdqcVNsVMzQzmNgNPBsRhVQVVzMs

View File

@ -1,4 +1,3 @@
extern crate core;
pub mod prob1;
pub mod prob2;
pub mod prob2;
pub mod prob3;

View File

@ -1,4 +1,4 @@
use advent_of_code::{prob1, prob2};
use advent_of_code::{prob1, prob2, prob3};
fn main() {
{
@ -13,4 +13,9 @@ fn main() {
let max_part2 = prob2::solve_part2(file_path);
println!("Solution for problem 2 part 1: {max_part1}\nSolution for problem 2 part 2: {max_part2}");
}
{
let file_path = "prob3_part1.txt";
let max_part1 = prob3::solve_part1(file_path);
println!("{max_part1}");
}
}

19
src/prob3/mod.rs Normal file
View File

@ -0,0 +1,19 @@
use std::collections::HashSet;
pub fn solve_part1(file_path: &str) -> i32 {
let binding =
std::fs::read_to_string(file_path).expect("Please provide a text file as an argument.");
let content = binding
.lines()
.collect::<Vec<&str>>()
.iter()
.map(|item: &&str| {
let (first, last) = item.split_at(item.len() / 2);
let second = last.chars().collect::<HashSet<char>>();
let intersection = first.chars().collect::<HashSet<char>>();
*intersection.intersection(&second).next().unwrap()
})
.collect::<Vec<char>>();
0
}