Amazon Interview Question

topological sort, solving postfix expression