Skip to content

Instantly share code, notes, and snippets.

View ericnograles's full-sized avatar

Eric Nograles ericnograles

View GitHub Profile
@ericnograles
ericnograles / infix-prefix.md
Last active September 17, 2020 13:30 — forked from ohbadiah/infix-prefix
Infix-prefix coding problem

We have some expressions, represented as a list where every term is either:

  • A variable (e.g. A, B, C)
  • A boolean operator (AND or OR)
  • A nested expression (list)

You're presented an expression with infix operators, like:

[A AND [B OR C]]

Can you transform these expressions so the operators are in prefix order? The output for this case is: