mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
39 lines
1.2 KiB
HTML
39 lines
1.2 KiB
HTML
<p>给定一个整数数组 <code>A</code>,找出索引为 (i, j, k) 的三元组,使得:</p>
|
||
|
||
<ul>
|
||
<li><code>0 <= i < A.length</code></li>
|
||
<li><code>0 <= j < A.length</code></li>
|
||
<li><code>0 <= k < A.length</code></li>
|
||
<li><code>A[i] & A[j] & A[k] == 0</code>,其中 <code>&</code> 表示按位与(AND)操作符。</li>
|
||
</ul>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例:</strong></p>
|
||
|
||
<pre><strong>输入:</strong>[2,1,3]
|
||
<strong>输出:</strong>12
|
||
<strong>解释:</strong>我们可以选出如下 i, j, k 三元组:
|
||
(i=0, j=0, k=1) : 2 & 2 & 1
|
||
(i=0, j=1, k=0) : 2 & 1 & 2
|
||
(i=0, j=1, k=1) : 2 & 1 & 1
|
||
(i=0, j=1, k=2) : 2 & 1 & 3
|
||
(i=0, j=2, k=1) : 2 & 3 & 1
|
||
(i=1, j=0, k=0) : 1 & 2 & 2
|
||
(i=1, j=0, k=1) : 1 & 2 & 1
|
||
(i=1, j=0, k=2) : 1 & 2 & 3
|
||
(i=1, j=1, k=0) : 1 & 1 & 2
|
||
(i=1, j=2, k=0) : 1 & 3 & 2
|
||
(i=2, j=0, k=1) : 3 & 2 & 1
|
||
(i=2, j=1, k=0) : 3 & 1 & 2
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ol>
|
||
<li><code>1 <= A.length <= 1000</code></li>
|
||
<li><code>0 <= A[i] < 2^16</code></li>
|
||
</ol>
|