From a81daf20d1dd78ea630bad2fc7e72b93c6215a81 Mon Sep 17 00:00:00 2001 From: mirsella Date: Thu, 5 Dec 2024 08:20:49 +0100 Subject: [PATCH] use hashmap --- 2024/day5/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2024/day5/src/main.rs b/2024/day5/src/main.rs index ed4c25d..13ca94b 100644 --- a/2024/day5/src/main.rs +++ b/2024/day5/src/main.rs @@ -1,10 +1,10 @@ use itertools::Itertools; -use std::collections::BTreeMap; +use std::collections::HashMap; fn part1(input: &str) -> usize { let split = input.split_once("\n\n").unwrap(); let ordering = { - let mut map = BTreeMap::>::new(); + let mut map = HashMap::>::new(); split.0.lines().for_each(|l| { let s = l.split_once('|').unwrap(); map.entry(s.1.parse::().unwrap()) @@ -29,7 +29,7 @@ fn part1(input: &str) -> usize { fn part2(input: &str) -> usize { let split = input.split_once("\n\n").unwrap(); let ordering = { - let mut map = BTreeMap::>::new(); + let mut map = HashMap::>::new(); split.0.lines().for_each(|l| { let s = l.split_once('|').unwrap(); map.entry(s.1.parse::().unwrap())