Check for index 0 if given value val can be obtained by either adding to or subtracting arr [ 0 ] from num .
if ( $ ind == 0 ) { if ( $ num - $ arr [ $ ind ] == $ val $ num + $ arr [ $ ind ] == $ val ) { $ dp [ $ ind ] [ $ val ] = 1 ; } else { $ dp [ $ ind ] [ $ val ] = 0 ; } } else {