Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
connorslade committed Dec 1, 2023
1 parent d69bc3a commit 3a2e832
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Thank you to [Eric Wastl](http://was.tl) for running this incredible yearly even

## [2023](https://adventofcode.com/2022) [![aoc_2023](https://github.com/Basicprogrammer10/advent-of-code/actions/workflows/aoc_2023.yml/badge.svg)](https://github.com/Basicprogrammer10/advent-of-code/actions/workflows/aoc_2023.yml)

- [Day 01:](aoc_2023/src/day_01.rs)
- [Day 01: Trebuchet?!](aoc_2023/src/day_01.rs)

## [2022](https://adventofcode.com/2022) [![aoc_2022](https://github.com/Basicprogrammer10/advent-of-code/actions/workflows/aoc_2022.yml/badge.svg)](https://github.com/Basicprogrammer10/advent-of-code/actions/workflows/aoc_2022.yml)

Expand Down
9 changes: 2 additions & 7 deletions aoc_2023/src/day_01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ impl Solution for Day01 {
let mut sum = 0;
for line in input.lines() {
let digits = digits(line);
let first = digits[0];
let last = digits[digits.len() - 1];

sum += first * 10 + last;
sum += digits[0] * 10 + digits[1];
}

sum.into()
Expand All @@ -42,10 +39,8 @@ fn digits(i: &str) -> [u32; 2] {
let mut last = 0;

let mut digit = |c| {
first = first.or(Some(c));
last = c;
if first.is_none() {
first = Some(c);
}
};

let chars = i.as_bytes();
Expand Down

0 comments on commit 3a2e832

Please sign in to comment.