2568. Minimum Impossible OR ¶ Time: $O(n + 32) = O(n)$ Space: $O(n)$ C++JavaPython 1 2 3 4 5 6 7 8 9 10 11 12class Solution { public: int minImpossibleOR(vector<int>& nums) { int ans = 1; const unordered_set<int> numsSet{nums.begin(), nums.end()}; while (numsSet.contains(ans)) ans <<= 1; return ans; } }; 1 2 3 4 5 6 7 8 9 10 11class Solution { public int minImpossibleOR(int[] nums) { int ans = 1; Set<Integer> numsSet = Arrays.stream(nums).boxed().collect(Collectors.toSet()); while (numsSet.contains(ans)) ans <<= 1; return ans; } } 1 2 3 4 5 6 7 8 9class Solution: def minImpossibleOR(self, nums: list[int]) -> int: ans = 1 numsSet = set(nums) while ans in numsSet: ans <<= 1 return ans