Re: [閒聊] 每日leetcode

看板Marginalman作者 (通通打死)時間1年前 (2024/11/08 23:13), 編輯推噓1(100)
留言1則, 1人參與, 1年前最新討論串1098/1548 (看更多)
拐彎抹角的題目 可能也因為這樣所以才是medium吧= = def getMaximumXor(self, nums: List[int], maximumBit: int) -> List[int]: ans = [] mask = 2**(maximumBit)-1 cur_xor = 0 for num in nums: cur_xor = cur_xor ^ num ans.append((~(cur_xor&mask))&mask) return ans[::-1] -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.229.37.69 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1731078827.A.C5F.html

11/08 23:20, 1年前 , 1F
大師
11/08 23:20, 1F
文章代碼(AID): #1dBYghnV (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1dBYghnV (Marginalman)