diff --git "a/leetcode3/\354\265\234\353\257\274\354\247\200/3314.py" "b/leetcode3/\354\265\234\353\257\274\354\247\200/3314.py" new file mode 100644 index 00000000..cc5751fa --- /dev/null +++ "b/leetcode3/\354\265\234\353\257\274\354\247\200/3314.py" @@ -0,0 +1,15 @@ +class Solution: + def minBitwiseArray(self, nums: List[int]) -> List[int]: + ans = [] + for n in nums: + if n % 2 == 0: + ans.append(-1) + else: + # 10 || 01 = 11 + # 100 || 101 = 101 + # 110 || 111 = 111 + for x in range(n): + if (x | (x+1)) == n: + ans.append(x) + break + return ans