1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-12 17:05:15 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2025-09-29 14:43:44 +08:00
parent 2862a227c4
commit 13f2098086
4409 changed files with 168933 additions and 166256 deletions

View File

@@ -1,20 +1,22 @@
<p>给定一个布尔表达式和一个期望的布尔结果 result布尔表达式由 <code>0</code> (false)、<code>1</code> (true)、<code>&amp;</code> (AND)、 <code>|</code> (OR) 和 <code>^</code> (XOR) 符号组成。实现一个函数,算出有几种可使该表达式得出 result 值的括号方法。</p>
<p><strong>示例 1:</strong></p>
<p><strong>示例 1</strong></p>
<pre><strong>输入: </strong>s = &quot;1^0|0|1&quot;, result = 0
<pre>
<strong>输入:</strong>s = "1^0|0|1", result = 0
<strong>输出: </strong>2
<strong>解释:</strong>&nbsp;两种可能的括号方法是
<strong>输出</strong>2
<strong>解释</strong>两种可能的括号方法是
1^(0|(0|1))
1^((0|0)|1)
</pre>
<p><strong>示例 2:</strong></p>
<p><strong>示例 2</strong></p>
<pre><strong>输入: </strong>s = &quot;0&amp;0&amp;0&amp;1^1|0&quot;, result = 1
<pre>
<strong>输入:</strong>s = "0&amp;0&amp;0&amp;1^1|0", result = 1
<strong>输出: </strong>10</pre>
<strong>输出</strong>10</pre>
<p><strong>提示:</strong></p>