WA in INPSTFIX

CodeChef: Practical coding for everyone.

My this solution got accepted, but this do not took care of right to left precedence of ‘^’… try this : 1 5 a^b^c output should be abc^^. which is not.

I fixed it here but it is showing wrong answer.
CodeChef: Practical coding for everyone.

help.

Precedence of ^ is left to right
check at the end of this page (Operator Precedence and Associativity in C - GeeksforGeeks)

1 Like

How do we know this ‘^’ is xor not ‘^’ exponentiation operator?
Try converting them here.
https://www.mathblog.dk/tools/infix-postfix-converter/

^ is xor operator in programming (it is exponentiation operator in mathematics). Problem setter should have mentioned this.

1 Like