Dsa
Stack
Easy
Postfix Validity Checker
Create a program to determine whether a given postfix expression is valid. A valid postfix expression will have at least two operands for every operator.
Input format:
- A single line with space-separated strings representing the postfix expression (1 <= number of tokens <= 10^4).
Output format:
- Print 'VALID' if the postfix expression is valid, otherwise print 'INVALID'.
Example:
Input:
2 3 +
Output:
VALID
Key concepts
stackvalidationpostfix
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