Amazon Interview Question

Re-derive the shunting yard algorithm