Generate an array consisting of elements of the current column
int [ ] temp = new int [ N ] ; for ( int j = 0 ; j < N ; j ++ ) { temp [ j ] = arr [ j , i ] ; } if ( ! checkBitonic ( temp , N ) ) { Console . WriteLine ( " NO " ) ; return ; } } Console . WriteLine ( " YES " ) ; } public static int [ ] GetRow ( int [ , ] matrix , int row ) { var rowLength = matrix . GetLength ( 1 ) ; var rowVector = new int [ rowLength ] ; for ( var i = 0 ; i < rowLength ; i ++ ) rowVector [ i ] = matrix [ row , i ] ; return rowVector ; }