1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-18 03:26:45 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 12:43:11 +08:00
parent 58bbdfd57c
commit 2b0511d272
10721 changed files with 8123 additions and 8119 deletions

View File

@@ -0,0 +1,23 @@
<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>
<pre><strong>输入: </strong>s = &quot;1^0|0|1&quot;, result = 0
<strong>输出: </strong>2
<strong>解释:</strong>&nbsp;两种可能的括号方法是
1^(0|(0|1))
1^((0|0)|1)
</pre>
<p><strong>示例 2:</strong></p>
<pre><strong>输入: </strong>s = &quot;0&amp;0&amp;0&amp;1^1|0&quot;, result = 1
<strong>输出: </strong>10</pre>
<p><strong>提示:</strong></p>
<ul>
<li>运算符的数量不超过 19 个</li>
</ul>