mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part2
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<p>给定一个布尔表达式和一个期望的布尔结果 result,布尔表达式由 <code>0</code> (false)、<code>1</code> (true)、<code>&</code> (AND)、 <code>|</code> (OR) 和 <code>^</code> (XOR) 符号组成。实现一个函数,算出有几种可使该表达式得出 result 值的括号方法。</p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre><strong>输入: </strong>s = "1^0|0|1", result = 0
|
||||
|
||||
<strong>输出: </strong>2
|
||||
<strong>解释:</strong> 两种可能的括号方法是
|
||||
1^(0|(0|1))
|
||||
1^((0|0)|1)
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre><strong>输入: </strong>s = "0&0&0&1^1|0", result = 1
|
||||
|
||||
<strong>输出: </strong>10</pre>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li>运算符的数量不超过 19 个</li>
|
||||
</ul>
|
Reference in New Issue
Block a user