Company: UKG OnCampus_14june
Difficulty: medium
Dual Expression Evaluator You are building an expression evaluator that keeps its operands in two containers at once : a LIFO container (a stack) — the most recently added element sits on top; a FIFO container (a queue) — the earliest added element sits at the front. Both containers start empty. The evaluator is driven by a sequence of N operations, processed strictly left to right. Operations Operation Meaning PUSH x add x on top of the LIFO container POP remove the top element of the LIFO container; if it is empty, do nothing ENQUEUE x add x at the back of the FIFO container DEQUEUE remove the front element of the FIFO container; if it is empty, do nothing ADD or + arithmetic: a + b SUB or - arithmetic: a - b MUL or * arithmetic: a * b DIV or / arithmetic: a / b , integer division truncated toward zero Every arithmetic operation is carried out in exactly this way: remove the top element of the LIFO container — call it a ; remove the front element of the FIFO container — call it b ; c