Class Solution
java.lang.Object
g2501_2600.s2568_minimum_impossible_or.Solution
2568 - Minimum Impossible OR.<p>Medium</p>
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>.</p>
<p>We say that an integer x is <strong>expressible</strong> from <code>nums</code> if there exist some integers <code>0 <= index<sub>1</sub> < index<sub>2</sub> < … < index<sub>k</sub> < nums.length</code> for which <code>nums[index<sub>1</sub>] | nums[index<sub>2</sub>] | … | nums[index<sub>k</sub>] = x</code>. In other words, an integer is expressible if it can be written as the bitwise OR of some subsequence of <code>nums</code>.</p>
<p>Return <em>the minimum <strong>positive non-zero integer</strong> that is not</em> <em>expressible from</em> <code>nums</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> nums = [2,1]</p>
<p><strong>Output:</strong> 4</p>
<p><strong>Explanation:</strong> 1 and 2 are already present in the array. We know that 3 is expressible, since nums[0] | nums[1] = 2 | 1 = 3. Since 4 is not expressible, we return 4.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> nums = [5,3,2]</p>
<p><strong>Output:</strong> 1</p>
<p><strong>Explanation:</strong> We can show that 1 is the smallest number that is not expressible.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>
<li><code>1 <= nums[i] <= 10<sup>9</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
minImpossibleOR
public int minImpossibleOR(int[] nums)
-