|
1 | | -# CodingProblems |
| 1 | +# Coding Challenges |
| 2 | +### This repository contains various coding challenges taken on Sites like HackerRank, LeetCode etc. |
| 3 | + |
| 4 | +##Challenge#1- Perfix Notation |
| 5 | +#### Write a function that evaluates an expression written in Prefix Notiation and returrns a value |
| 6 | +* Problem Statement: |
| 7 | +Prefix notation (also known as polish notation) is an alternative to the more familier infix notation. |
| 8 | + |
| 9 | +In infix notation, operators(add,multiply,etc) are written between their operands(number, variables, or sub-expression). |
| 10 | +* In prefix notation, operators are written before their operands |
| 11 | +Some examples follow of expression in infix notation and their equivalents in prefix notation. |
| 12 | +In this example the operator is + and its operands are 1 and 2: |
| 13 | + |
| 14 | +``` |
| 15 | +Infix expression: 1 + 2 |
| 16 | +Prefix expression: + 1 2 |
| 17 | +Value: 3 |
| 18 | +``` |
| 19 | + |
| 20 | +In this example, the sub-expression + 1 2 is the first operand of the + operator |
| 21 | + |
| 22 | +``` |
| 23 | +Infix expression: (1+2) * 3 |
| 24 | +Prefix expression: * + 1 2 3 |
| 25 | +Value: 9 |
| 26 | +``` |
0 commit comments