Class Solution
java.lang.Object
g1101_1200.s1106_parsing_a_boolean_expression.Solution
1106 - Parsing A Boolean Expression.<p>Hard</p>
<p>Return the result of evaluating a given boolean <code>expression</code>, represented as a string.</p>
<p>An expression can either be:</p>
<ul>
<li><code>"t"</code>, evaluating to <code>True</code>;</li>
<li><code>"f"</code>, evaluating to <code>False</code>;</li>
<li><code>"!(expr)"</code>, evaluating to the logical NOT of the inner expression <code>expr</code>;</li>
<li><code>"&(expr1,expr2,...)"</code>, evaluating to the logical AND of 2 or more inner expressions <code>expr1, expr2, ...</code>;</li>
<li><code>"|(expr1,expr2,...)"</code>, evaluating to the logical OR of 2 or more inner expressions <code>expr1, expr2, ...</code></li>
</ul>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> expression = “!(f)”</p>
<p><strong>Output:</strong> true</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> expression = “|(f,t)”</p>
<p><strong>Output:</strong> true</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> expression = “&(t,f)”</p>
<p><strong>Output:</strong> false</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= expression.length <= 2 * 10<sup>4</sup></code></li>
<li><code>expression[i]</code> consists of characters in <code>{'(', ')', '&', '|', '!', 't', 'f', ','}</code>.</li>
<li><code>expression</code> is a valid expression representing a boolean, as given in the description.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
parseBoolExpr
-