Skip to content

Commit

Permalink
clean day 5 part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
cdelaorden committed Dec 27, 2023
1 parent eb4698d commit 6200e40
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/days/5/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ const getLocation = (
return search
}

export function day5partOne(sample: string, _input: string) {
const sections = _input.split('\n\n')
export function day5partOne(_sample: string, input: string) {
const sections = input.split('\n\n')
const seeds = Array.from(sections[0]?.trim().matchAll(/(\d+)/g) ?? []).map(
(m) => Number(m[0])
)
const almanac = makeAlmanac(sections)
console.log('Seeds: %o. \nAlmanac: %o', seeds, almanac)
const minLocation = seeds
.map((s) => getLocation(almanac, s))
.reduce((acc, x) => (x < acc ? x : acc), Infinity)
Expand Down

0 comments on commit 6200e40

Please sign in to comment.