initializing minval and maxval 2D array
for ( let i = 0 ; i < len ; i ++ ) { minVal [ i ] = new Array ( len ) ; maxVal [ i ] = new Array ( len ) ; for ( let j = 0 ; j < len ; j ++ ) { minVal [ i ] [ j ] = Number . MAX_VALUE ; maxVal [ i ] [ j ] = 0 ;