Insert all element of arr [ ] into priority queue . Default priority queue in Python is min - heap so use - 1 * arr [ i ]
for i in range ( n ) : NEW_LINE INDENT heap . put ( - 1 * arr [ i ] ) NEW_LINE DEDENT