Dsa
Stack
Easy
Basic Calculator
Implement a basic calculator that can evaluate a simple expression string containing non-negative integers, '+', '-', '(', and ')'. The input string may contain spaces. Return the result as an integer. Write a program that reads a single line of input string and prints the evaluated result. Example: Input: '1 + 1', Output: '2'
Key concepts
stackarithmetic
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