diff --git a/04/index.ts b/04/index.ts index 630ce56..98005de 100644 --- a/04/index.ts +++ b/04/index.ts @@ -16,7 +16,7 @@ console.log( .slice(0, -1) .reduce((coll, curr, index, array) => { // 2D string matching is a pain. Let's turn it into a 1D problem! - // create the down rows + // create the columns curr.split("").forEach((s, i) => { coll[i] = coll[i] ? coll[i] + s : s; }); @@ -34,7 +34,7 @@ console.log( ? coll[array.length * 4 + index - i - 2] + s : s; }); - // include the original crosses + // include the original row return [...coll, curr]; }, Array.from({ length: test ? 10 + (10 * 4 - 2) : 140 + 140 * 4 - 2 }) as string[]) .reduce((total, curr) => {