Amazon Interview Question

Simulate a FIFO and LIFO heap in either Java or Python.