Amazon interview question

Re-derive the shunting yard algorithm