If the array is traversed and no element has been selected yet then select the current element
if ( i == n - 1 and is_selected == 0 ) : NEW_LINE INDENT dp [ i ] [ prev ] = arr [ i ] NEW_LINE return dp [ i ] [ prev ] NEW_LINE DEDENT