Dsa
Stack
Medium
Evaluate Postfix Expression
You are given a string representing a postfix expression. The expression contains single-digit integers and operators ('+', '-', '*', '/'). Your task is to evaluate the expression and return the result.
Input:
A single line containing the postfix expression, where each token is separated by a space.
Output:
An integer representing the evaluation result of the postfix expression.
Example:
Input:
3 4 + 2 * 7 /
Output:
2
Key concepts
stackevaluationpostfix
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