After finding reciprocal , check if the reciprocal is in A . P . To check for A . P . , first Sort the reciprocal array , then check difference between consecutive elements
rec . sort ( ) NEW_LINE d = rec [ 1 ] - rec [ 0 ] NEW_LINE for i in range ( 2 , n ) : NEW_LINE INDENT if ( rec [ i ] - rec [ i - 1 ] != d ) : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT return True NEW_LINE