If either of one condition is True , then val is obtainable at index ind .
if ( dp [ ind - 1 ] [ val - arr [ ind ] ] == 1 or dp [ ind - 1 ] [ val + arr [ ind ] ] == 1 ) : NEW_LINE INDENT dp [ ind ] [ val ] = 1 ; NEW_LINE DEDENT elif ( val - arr [ ind ] >= 0 ) : NEW_LINE dp [ ind ] [ val ] = dp [ ind - 1 ] [ val - arr [ ind ] ] ; NEW_LINE elif ( val + arr [ ind ] <= maxLimit ) : NEW_LINE dp [ ind ] [ val ] = dp [ ind - 1 ] [ val + arr [ ind ] ] ; NEW_LINE else : NEW_LINE dp [ ind ] [ val ] = 0 ; NEW_LINE