setting up for 2024 day 6 and fixing some of the comments
This commit is contained in:
@@ -19,7 +19,7 @@ pub enum Day5Part1Error {
|
||||
type Orderings = HashMap<u32, Vec<u32>>;
|
||||
|
||||
/// Day-5 Part 1 for 2024 advent of code
|
||||
/// Problem can be found here: <https://adventofcode.com/2024/day/3>
|
||||
/// Problem can be found here: <https://adventofcode.com/2024/day/5>
|
||||
///
|
||||
/// # Errors
|
||||
/// - `ParseError` there was an issue with the parser
|
||||
|
||||
@@ -16,7 +16,7 @@ pub enum Day5Part2Error{
|
||||
type Orderings = HashMap<u32, Vec<u32>>;
|
||||
|
||||
/// Day-5 Part 2 for 2024 advent of code
|
||||
/// Problem can be found here: <https://adventofcode.com/2024/day/3>
|
||||
/// Problem can be found here: <https://adventofcode.com/2024/day/5#part2>
|
||||
///
|
||||
/// # Errors
|
||||
/// - `ParseError` there was an issue with the parser
|
||||
@@ -55,22 +55,6 @@ pub fn part2 (input: &str) -> Result<String, Day5Part2Error> {
|
||||
Ok(middles.to_string())
|
||||
}
|
||||
|
||||
/*
|
||||
* --- Part Two ---
|
||||
|
||||
While the Elves get to work printing the correctly-ordered updates, you have a little time to fix the rest of them.
|
||||
|
||||
For each of the incorrectly-ordered updates, use the page ordering rules to put the page numbers in the right order. For the above example, here are the three incorrectly-ordered updates and their correct orderings:
|
||||
|
||||
75,97,47,61,53 becomes 97,75,47,61,53.
|
||||
61,13,29 becomes 61,29,13.
|
||||
97,13,75,29,47 becomes 97,75,47,29,13.
|
||||
|
||||
After taking only the incorrectly-ordered updates and ordering them correctly, their middle page numbers are 47, 29, and 47. Adding these together produces 123.
|
||||
|
||||
Find the updates which are not in the correct order. What do you get if you add up the middle page numbers after correctly ordering just those updates?
|
||||
*/
|
||||
|
||||
fn parse_ordering(input: &str) -> IResult<&str, Orderings> {
|
||||
let (input, rules) = separated_list1(
|
||||
complete::line_ending,
|
||||
|
||||
Reference in New Issue
Block a user