PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

Practice a Amazon coding interview problem focused on evaluate an arithmetic expression in postfix notation. The prompt emphasizes edge cases, clean implementation, and verifiable test behavior without revealing the solution.

  • hard
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Evaluate an Arithmetic Expression in Postfix Notation

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Onsite

Evaluate an arithmetic expression in postfix notation with integer tokens and operators `+`, `-`, `*`, and `/`. Division truncates toward zero. Implement: ```python def eval_postfix(tokens: list[str]) -> int: pass ```

Quick Answer: Practice a Amazon coding interview problem focused on evaluate an arithmetic expression in postfix notation. The prompt emphasizes edge cases, clean implementation, and verifiable test behavior without revealing the solution.

Evaluate integer postfix notation with truncating division.

Examples

Input: {"tokens":["2","3","+","4","*"]}

Expected Output: 20

Explanation: (2+3)*4.

Input: {"tokens":["4","13","5","/","+"]}

Expected Output: 6

Explanation: 13/5 truncates to 2.

Input: {"tokens":["-7","3","/"]}

Expected Output: -2

Explanation: Truncate toward zero.

Input: {"tokens":["7","-3","/"]}

Expected Output: -2

Explanation: Negative divisor.

Input: {"tokens":["5"]}

Expected Output: 5

Explanation: Single value.

Input: {"tokens":["10","6","9","3","+","-11","*","/","*","17","+","5","+"]}

Expected Output: 22

Explanation: Complex expression.

Input: {"tokens":["3","4","-"]}

Expected Output: -1

Explanation: Subtraction order.

Input: {"tokens":["3","-4","*"]}

Expected Output: -12

Explanation: Multiplication.

Last updated: Jul 4, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,500+ 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
  • AI Coding 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.

Related Coding Questions

  • Minimum Path Length Through a Grid With One Allowed Cell Conversion - Amazon (medium)
  • Circular Drone Hub Delivery Route - Amazon (hard)
  • Leaf Domain Cumulative Scores - Amazon (medium)
  • Kth Largest Perfect Binary Subtree - Amazon (medium)
  • Find Conflicting Events - Amazon (medium)