File tree 1 file changed +1
-3
lines changed
1 file changed +1
-3
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,7 @@ function greatestProductDiagonals(squareMatrix) {
277
277
if ( squareMatrix . length - colIndex >= 4 && squareMatrix . length - rowIndex >= 4 ) {
278
278
tempRightDiagProduct = squareMatrix [ rowIndex ] [ colIndex ] * squareMatrix [ rowIndex + 1 ] [ colIndex + 1 ] * squareMatrix [ rowIndex + 2 ] [ colIndex + 2 ] * squareMatrix [ rowIndex + 3 ] [ colIndex + 3 ]
279
279
}
280
- if ( colIndex - squareMatrix . length >= 4 && rowIndex - squareMatrix . length >= 4 ) {
280
+ if ( squareMatrix . length - colIndex >= 4 && rowIndex >= 4 ) {
281
281
tempLeftDiagProduct = squareMatrix [ rowIndex ] [ colIndex ] * squareMatrix [ rowIndex - 1 ] [ colIndex - 1 ] * squareMatrix [ rowIndex - 2 ] [ colIndex - 2 ] * squareMatrix [ rowIndex - 3 ] [ colIndex - 3 ]
282
282
}
283
283
if ( tempRightDiagProduct > tempLeftDiagProduct && tempRightDiagProduct > product ) {
@@ -291,8 +291,6 @@ function greatestProductDiagonals(squareMatrix) {
291
291
}
292
292
293
293
294
-
295
-
296
294
// The following is required to make unit tests work.
297
295
/* Environment setup. Do not modify the below code. */
298
296
if ( typeof module !== 'undefined' ) {
You can’t perform that action at this time.
0 commit comments