Skip to content
Discussion options

You must be logged in to vote

We need to think carefully about how the bitwise XOR operates and how the pairing of elements in nums1 and nums2 affects the result.

Key Observations:

  1. Each element in nums1 pairs with every element in nums2, and vice versa.

  2. In nums3, each number from nums1 and nums2 appears multiple times:

    • Each number from nums1 appears n times (where n is the length of nums2).
    • Each number from nums2 appears m times (where m is the length of nums1).
  3. The XOR operation has a property that if a number appears an even number of times, it will cancel out (because x ^ x = 0), and if it appears an odd number of times, it contributes to the final XOR result.

Approach:

  • For each bit position (from 0 to 3…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Jan 16, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants