for loopified
This commit is contained in:
parent
199303ce82
commit
d28803dba6
1 changed files with 4 additions and 6 deletions
|
@ -27,14 +27,12 @@ class DayFour implements Solvable {
|
||||||
let [b,a] = [0, mat[0].length - 1]
|
let [b,a] = [0, mat[0].length - 1]
|
||||||
const lines = []
|
const lines = []
|
||||||
while (b < mat.length) {
|
while (b < mat.length) {
|
||||||
let [y,x] = [b,a]
|
|
||||||
|
|
||||||
let line = ''
|
let line = ''
|
||||||
// walk top left of diagonal to bottom right
|
for (let [y,x] = [b,a]; x < mat[y].length && y < mat.length - 1; y++,x++)
|
||||||
while (x < mat[y].length && y < mat.length - 1) {
|
|
||||||
line += mat[y][x]
|
line += mat[y][x]
|
||||||
y++
|
|
||||||
x++
|
|
||||||
}
|
|
||||||
lines.push(line.split(''))
|
lines.push(line.split(''))
|
||||||
|
|
||||||
if (a > 0) {
|
if (a > 0) {
|
||||||
|
|
Loading…
Reference in a new issue