Problem Submissions Solution

Convert Infix To Prefix Notation

Difficulty: Medium

Acceptance: %

Points: 30.00

You are given an infix expression as a string s and need to convert it into a postfix expression.

  1. Infix Expression: This is the standard mathematical notation where operators are placed between operands, e.g., a op b (e.g., a + b).
  2. Postfix Expression: This is a format where the operator follows the operands, e.g., a b op (e.g., a b +).

Note: Follow the operator precedence:

  • ^ has the highest precedence.
  • * and / have equal precedence, which is higher than + and -.
  • For simplicity, ignore the right associativity of ^.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n)

Expected Auxiliary Space: O(n)

Constraints:
  • 1 <= s.length <= 30
Companies:
Microsoft Visa Paytm
Topics:
Stack
Locked Content
Access Restricted: Please Login to access the code editor and test cases.