Back to problems

Prefix to Postfix

Algorithm · Affirm · Medium

Problem You are given a string representing a valid prefix expression. Your task is to transform it into its equivalent postfix expression. In a prefix expression, the operator comes before its operands. For instance, *+AB-CD represents the infix expression (A+B) * (C-D). In a postfix expression, the operator comes after its operands. The same infix expression (A+B) * (C-D) becomes AB+CD-* in postfix notation. You may assume the input consists exclusively of single-digit…

Checking your access…