Skip to content

Commit 75d194b

Browse files
committed
Create README - LeetHub
1 parent 527cb8e commit 75d194b

File tree

1 file changed

+43
-0
lines changed
  • 2044-count-number-of-maximum-bitwise-or-subsets

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<h2><a href="https://leetcode.com/problems/count-number-of-maximum-bitwise-or-subsets/">2044. Count Number of Maximum Bitwise-OR Subsets</a></h2><h3>Medium</h3><hr><div><p>Given an integer array <code>nums</code>, find the <strong>maximum</strong> possible <strong>bitwise OR</strong> of a subset of <code>nums</code> and return <em>the <strong>number of different non-empty subsets</strong> with the maximum bitwise OR</em>.</p>
2+
3+
<p>An array <code>a</code> is a <strong>subset</strong> of an array <code>b</code> if <code>a</code> can be obtained from <code>b</code> by deleting some (possibly zero) elements of <code>b</code>. Two subsets are considered <strong>different</strong> if the indices of the elements chosen are different.</p>
4+
5+
<p>The bitwise OR of an array <code>a</code> is equal to <code>a[0] <strong>OR</strong> a[1] <strong>OR</strong> ... <strong>OR</strong> a[a.length - 1]</code> (<strong>0-indexed</strong>).</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre><strong>Input:</strong> nums = [3,1]
11+
<strong>Output:</strong> 2
12+
<strong>Explanation:</strong> The maximum possible bitwise OR of a subset is 3. There are 2 subsets with a bitwise OR of 3:
13+
- [3]
14+
- [3,1]
15+
</pre>
16+
17+
<p><strong class="example">Example 2:</strong></p>
18+
19+
<pre><strong>Input:</strong> nums = [2,2,2]
20+
<strong>Output:</strong> 7
21+
<strong>Explanation:</strong> All non-empty subsets of [2,2,2] have a bitwise OR of 2. There are 2<sup>3</sup> - 1 = 7 total subsets.
22+
</pre>
23+
24+
<p><strong class="example">Example 3:</strong></p>
25+
26+
<pre><strong>Input:</strong> nums = [3,2,1,5]
27+
<strong>Output:</strong> 6
28+
<strong>Explanation:</strong> The maximum possible bitwise OR of a subset is 7. There are 6 subsets with a bitwise OR of 7:
29+
- [3,5]
30+
- [3,1,5]
31+
- [3,2,5]
32+
- [3,2,1,5]
33+
- [2,5]
34+
- [2,1,5]</pre>
35+
36+
<p>&nbsp;</p>
37+
<p><strong>Constraints:</strong></p>
38+
39+
<ul>
40+
<li><code>1 &lt;= nums.length &lt;= 16</code></li>
41+
<li><code>1 &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>
42+
</ul>
43+
</div>

0 commit comments

Comments
 (0)