Driver code
n = 4 ; var dp = Array ( n ) . fill ( ) . map ( ( ) => Array ( 4 ) . fill ( 0 ) ) ; for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < 4 ; j ++ ) { dp [ i ] [ j ] = - 1 ; } } for ( i = 0 ; i < n ; i ++ ) {