Solution Review: Infix-to-Prefix Conversion

Let’s take a detailed look at the previous challenge’s solution.


  1. We reverse the given infix expression.
  2. We replace ( with ), and ) with ( in the reversed expression.
  3. Now, we apply infix to postfix subroutines that we’ve already discussed.
  4. We reverse the generated postfix expression. This will give the required prefix expression.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.