Check if the given matrix is increasing row and column wise | Java Script implementation of the approach ; Function that returns true if the matrix is strictly increasing ; Check if the matrix is strictly increasing ; Out of bound condition ; Out of bound condition ; Driver code
let N = 2 ; let M = 2 ; function isMatrixInc ( a ) { for ( let i = 0 ; i < N ; i ++ ) { for ( let j = 0 ; j < M ; j ++ ) { if ( i - 1 >= 0 ) { if ( a [ i ] [ j ] <= a [ i - 1 ] [ j ] ) return false ; } if ( j - 1 >= 0 ) { if ( a [ i ] [ j ] <= a [ i ] [ j - 1 ] ) return false ; } } } return true ; } let a = [ [ 2 , 10 ] , [ 11 , 20 ] ] ; if ( isMatrixInc ( a ) ) document . write ( " " ) ; else document . write ( " " ) ;