Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Remove redundant parentheses from an arithmetic expression

$
0
0

Its a interview question. I have not been able to get any optimal solution. Can someone share the logic and code for this. (preferably in Java)

e.g : ((ab)+c) should become ab+c.

My logic is Parenthesis are redundant if at least one of the operators has lower precedence than an operator attached directly to the parenthesized expression on either side of it. But I could not reach to final code.

Can someone help..?? Thanks in Advance..!!


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>