assign - 1 to all positions
for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < maximum ; j ++ ) { dp [ i , j ] = - 1 ; } } Console . WriteLine ( " Length ▁ of ▁ LCS : ▁ " + lcs ( X , Y , m , n , dp ) ) ; } }