Function to return true if the elements can be arranged in the desired order
def canReorder ( A ) : NEW_LINE INDENT count = collections . Counter ( A ) NEW_LINE for x in sorted ( A , key = abs ) : NEW_LINE INDENT if count [ x ] == 0 : NEW_LINE INDENT continue NEW_LINE DEDENT DEDENT DEDENT