2425. Bitwise XOR of All Pairings

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2425

class Solution:
    def xorAllNums(self, nums1: List[int], nums2: List[int]) -> int:
        res = 0
        if len(nums2) & 1:
            for v in nums1:
                res ^= v
        if len(nums1) & 1:
            for v in nums2:
                res ^= v
        return res