diff --git a/solutions/04.ts b/solutions/04.ts index 08b65a3..f3e3379 100644 --- a/solutions/04.ts +++ b/solutions/04.ts @@ -27,14 +27,12 @@ class DayFour implements Solvable { let [b,a] = [0, mat[0].length - 1] const lines = [] while (b < mat.length) { - let [y,x] = [b,a] + + let line = '' - // walk top left of diagonal to bottom right - while (x < mat[y].length && y < mat.length - 1) { + for (let [y,x] = [b,a]; x < mat[y].length && y < mat.length - 1; y++,x++) line += mat[y][x] - y++ - x++ - } + lines.push(line.split('')) if (a > 0) {