Dsa
Stack
Easy
Expression Postfix Evaluator
You are given a postfix expression represented as a string where operands and operators are separated by spaces. Implement a function to evaluate the postfix expression and return the result. The available operators are +, -, *, and / (integer division).
Input Format:
- A single line containing the postfix expression.
Output Format:
- Print the integer result of the evaluated expression.
Example:
Input:
2 3 + 5 *
Output:
25
Key concepts
stackpostfixexpression
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now