Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Math Interpreter with Function Definitions

Implement a math interpreter that processes a list of string commands acting on a single global integer x (initially 0). Commands are: ADD k (add k to x), MUL k (multiply x by k), FUN name (begin defining a named function), END (end the current function definition), and INV name (invoke a previously defined function on the current value of x). Functions do not execute when defined — only when invoked. A function body may contain ADD, MUL, and calls to other previously defined functions. There are no recursive calls or nested function definitions, and every invoked function is guaranteed to have been defined earlier. Commands execute sequentially, and functions may be invoked multiple times.

Asked at:

Snowflake


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Late May, 2026

Snowflake

Junior

You are creating an in-memory store that gets a stream of operations and you are supposed to perform this on a single address. The operations will be in this format: "ADD 3" -> add 3 to the address, "MUL 4" -> multiply 4 to the address, "FUN ABC" -> you are going to get function definition for the function name ABC. This will be till you encounter the next "END". "INV ABC" -> invoke function ABC and perform all of its operations on the address space

Late February, 2026

Snowflake

Junior

Implement a simple math interpreter that processes a list of string commands acting on a single global integer x, initially 0. The commands may be ADD k (add k to x), MUL k (multiply x by k), FUN name (start defining a function named name), END (end the current function definition), and INV name (invoke a previously defined function on the current value of x). A function does not execute when defined; it only executes when invoked, and its body may contain ADD, MUL, and calls to other functions. There are no recursive calls or nested function definitions, and every invoked function is guaranteed to have been defined earlier. All commands are executed sequentially, and functions may be invoked many times.

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.