2317. Maximum XOR After Operations
Read the full problem statement on LeetCode.
Difficulty: medium Acceptance: 79% Topics: Array, Math, Bit Manipulation
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(n)
# Space: O(1)
# bit manipulation
class Solution(object):
def maximumXOR(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return reduce(lambda x, y: x|y, nums)
Solution from kamyu104/LeetCode-Solutions · MIT