Find the position of the given row in a 2 | C # implementation of the approach ; Function to find a row in the given matrix using linear search ; Assume that the current row matched with the given array ; If any element of the current row doesn 't  match with the corresponding element  of the given array ; Set matched to false and break ; ; If matched then return the row number ; No row matched with the given array ; Driver code
using System ; class GFG { static int m = 6 ; static int n = 4 ; static int linearCheck ( int [ , ] ar , int [ ] arr ) { for ( int i = 0 ; i < m ; i ++ ) { bool matched = true ; for ( int j = 0 ; j < n ; j ++ ) { if ( ar [ i , j ] != arr [ j ] ) { matched = false ; break ; } } if ( matched ) return i + 1 ; } return - 1 ; } static public void Main ( ) { int [ , ] mat = { { 0 , 0 , 1 , 0 } , { 10 , 9 , 22 , 23 } , { 40 , 40 , 40 , 40 } , { 43 , 44 , 55 , 68 } , { 81 , 73 , 100 , 132 } , { 100 , 75 , 125 , 133 } } ; int [ ] row = { 10 , 9 , 22 , 23 } ; Console . Write ( linearCheck ( mat , row ) ) ; } }