Search
⌘K
Get Premium
Leetcode 2726. Calculator with Method Chaining
Implement a Calculator class whose constructor takes an initial numeric result and provides add, subtract, multiply, divide (throw "Division by zero is not allowed" for divisor 0), and power methods that each return the Calculator to allow method chaining, plus getResult to return the final value. Results within 1e-5 of the expected value are accepted.
Asked at:
Microsoft
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Early May, 2025
Microsoft
Mid-level
Early October, 2024
Mid-level
Implement a calculator to perform add, subtract, divide, modulus, multiply and power operations
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.