From a007a5a19daf88eadf06e818dbef4e0fc738b004 Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Tue, 5 Dec 2023 01:41:44 +0000 Subject: [PATCH] cleanup day 3 --- day3/solution.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/day3/solution.ts b/day3/solution.ts index 7ea8662..2359dce 100644 --- a/day3/solution.ts +++ b/day3/solution.ts @@ -26,15 +26,6 @@ function toSubComponents(l: string) { type Component = [number, number, string]; -function isPartNumber( - components: Component[], - component: Component, -) { - return Boolean( - components.find((c) => isAdjacent(component, c) && c[2] !== "."), - ); -} - /** * Checks whether two components are adjacent * @param c1 First component. @@ -51,6 +42,15 @@ function isAdjacent([y1, x1, s1]: Component, [y2, x2, s2]: Component) { ) || (y1 === y2) && (x2e === x1 - 1 || x2 === x1e + 1); } +function isPartNumber( + components: Component[], + component: Component, +) { + return Boolean( + components.find((c) => isAdjacent(component, c) && c[2] !== "."), + ); +} + function gearRatio( components: Component[], component: Component,