print the path
foreach ( int ele in path ) Console . Write ( ele + " ▁ - > ▁ " ) ; Console . WriteLine ( cur ) ; } static int accumulate ( int [ , ] matrix , int row , int sum ) { int [ ] arr = GetRow ( matrix , row ) ; foreach ( int i in arr ) sum += i ; return sum ; } 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 ; }