Skip to content

Commit c8fe4af

Browse files
authored
Create minimum-impossible-or.py
1 parent b672525 commit c8fe4af

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Python/minimum-impossible-or.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Time: O(logr)
2+
# Space: O(1)
3+
4+
# hash table, bit manipulations
5+
class Solution(object):
6+
def minImpossibleOR(self, nums):
7+
"""
8+
:type nums: List[int]
9+
:rtype: int
10+
"""
11+
lookup = set(nums)
12+
return next(1<<i for i in xrange(31) if 1<<i not in lookup)

0 commit comments

Comments
 (0)