Skip to content

Practice Minimum Impossible OR

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2568
LeetCode Problem

Minimum Impossible OR

Problem Statement

You are given a 0-indexed integer array nums. We say that an integer x is expressible from nums if there exist some integers 0 <= index1 < index2 < ... < indexk < nums.length for which nums[index1] | nums[index2] | ... | nums[indexk] = x. In other words, an integer is expressible if it can be written as the bitwise OR of some subsequence of nums. Return the minimum positive non-zero integer that is not expressible from nums.

Source: Minimum Impossible OR on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [2,1]
Output
4

# Example 2

Input
nums = [5,3,2]
Output
1

Constraints

1 <= nums.length <= 10^5
1 <= nums[i] <= 10^9

Related LeetCode Problems

Practice more problems similar to Minimum Impossible OR.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.