Solutions to Diophantine Equations using a Min Heap
A min-heap with entries $x_i$ is equivalent to a max-heap with entries $-x_i$ (or more generally, $A - Bx_i$ for any $B &gt; 0$, or even more generally, $\phi(x_i)$ for any monotone decreasing $\phi$). So you can convert your solution with two min-heaps to a solution with one min-heap and one max-heap, as well as to a solution with two max-heaps.