Every element must be either smaller than min or greater than max
for i in range ( size - 3 , 0 , - 1 ) : NEW_LINE INDENT if pre [ i ] < min : NEW_LINE INDENT min = pre [ i ] NEW_LINE DEDENT elif pre [ i ] > max : NEW_LINE INDENT max = pre [ i ] NEW_LINE DEDENT else : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT return True NEW_LINE