PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Docker

Evaluate an arithmetic expression

Last updated: Mar 29, 2026

Quick Overview

This question evaluates parsing and expression-evaluation skills, specifically handling operator precedence, integer division truncation, multi-digit numbers, and whitespace handling within the Coding & Algorithms domain.

  • medium
  • Docker
  • Coding & Algorithms
  • Software Engineer

Evaluate an arithmetic expression

Company: Docker

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Given a valid string expression containing non-negative integers, spaces, and the operators `+`, `-`, `*`, and `/`, return the computed result. Requirements: - The expression does not contain parentheses. - Integer division truncates toward zero. - The input may contain multi-digit numbers and arbitrary spaces. - You must handle operator precedence correctly: multiplication and division before addition and subtraction. Examples: - `"3+2*2"` -> `7` - `" 3/2 "` -> `1` - `" 3+5 / 2 "` -> `5` Discuss the time and space complexity of your approach.

Quick Answer: This question evaluates parsing and expression-evaluation skills, specifically handling operator precedence, integer division truncation, multi-digit numbers, and whitespace handling within the Coding & Algorithms domain.

Docker logo
Docker
Feb 14, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
3
0
Loading...

Given a valid string expression containing non-negative integers, spaces, and the operators +, -, *, and /, return the computed result.

Requirements:

  • The expression does not contain parentheses.
  • Integer division truncates toward zero.
  • The input may contain multi-digit numbers and arbitrary spaces.
  • You must handle operator precedence correctly: multiplication and division before addition and subtraction.

Examples:

  • "3+2*2" -> 7
  • " 3/2 " -> 1
  • " 3+5 / 2 " -> 5

Discuss the time and space complexity of your approach.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Docker•More Software Engineer•Docker Software Engineer•Docker Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.