Find if there exist i and k that form AP with j as middle element
while i > - 1 and k < n : NEW_LINE INDENT if set_ [ i ] + set_ [ k ] == 2 * set_ [ j ] : NEW_LINE INDENT return True NEW_LINE DEDENT elif set_ [ i ] + set_ [ k ] < 2 * set_ [ j ] : NEW_LINE INDENT i -= 1 NEW_LINE DEDENT else : NEW_LINE INDENT k += 1 NEW_LINE DEDENT DEDENT return False NEW_LINE