aboutsummaryrefslogtreecommitdiff
path: root/challenge-087/abigail/node
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2020-11-20 01:12:09 +0100
committerAbigail <abigail@abigail.be>2020-11-20 01:12:09 +0100
commit89d44496fb4950a2808637749b68461519f35329 (patch)
treea00590814e678610e5837824a84e4b4dd2fc0c9b /challenge-087/abigail/node
parentce3af91346700d98b3a0ef1c482b1388b63c4e6f (diff)
downloadperlweeklychallenge-club-89d44496fb4950a2808637749b68461519f35329.tar.gz
perlweeklychallenge-club-89d44496fb4950a2808637749b68461519f35329.tar.bz2
perlweeklychallenge-club-89d44496fb4950a2808637749b68461519f35329.zip
Use X and Y instead of matrix . length and matrix [x] . length.
Diffstat (limited to 'challenge-087/abigail/node')
-rw-r--r--challenge-087/abigail/node/ch-2.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/challenge-087/abigail/node/ch-2.js b/challenge-087/abigail/node/ch-2.js
index 5dedf7c4ce..18acd07ac4 100644
--- a/challenge-087/abigail/node/ch-2.js
+++ b/challenge-087/abigail/node/ch-2.js
@@ -99,8 +99,8 @@ if (X < Y) {
// Maps the 1s in the matrix to the number of consecutive 1s below
// it (including this 1 itself).
//
-for (let x = matrix . length - 2; x >= 0; x --) {
- for (let y = 0; y < matrix [x] . length; y ++) {
+for (let x = X - 2; x >= 0; x --) {
+ for (let y = 0; y < Y; y ++) {
matrix [x] [y] = matrix [x] [y] *
(matrix [x + 1] [y] + 1);
}
@@ -116,8 +116,8 @@ for (let x = matrix . length - 2; x >= 0; x --) {
// Remember the best one found.
//
let best = [0, 0];
-for (let x = 0; x < matrix . length; x ++) {
- for (let y = 0; y < matrix [x] . length; y ++) {
+for (let x = 0; x < X; x ++) {
+ for (let y = 0; y < Y; y ++) {
if (matrix [x] [y] == 0) {
continue;
}
@@ -125,7 +125,7 @@ for (let x = 0; x < matrix . length; x ++) {
if (min_depth > best [0] * best [1]) {
best = [min_depth, 1];
}
- for (w = 1; y + w < matrix [x] . length &&
+ for (w = 1; y + w < Y &&
matrix [x] [y + w] > 0; w ++) {
if (matrix [x] [y + w] < min_depth) {
min_depth = matrix [x] [y + w];