File size: 2,125 Bytes
f7c0146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
    "id": 2533,
    "name": "bitwise_xor_of_all_pairings",
    "difficulty": "Medium",
    "link": "https://leetcode.com/problems/bitwise-xor-of-all-pairings/",
    "date": "1663372800000",
    "task_description": "You are given two **0-indexed** arrays, `nums1` and `nums2`, consisting of non-negative integers. Let there be another array, `nums3`, which contains the bitwise XOR of **all pairings** of integers between `nums1` and `nums2` (every integer in `nums1` is paired with every integer in `nums2` **exactly once**). Return_ the **bitwise XOR** of all integers in _`nums3`. **Example 1:** ``` **Input:** nums1 = [2,1,3], nums2 = [10,2,5,0] **Output:** 13 **Explanation:** A possible nums3 array is [8,0,7,2,11,3,4,1,9,1,6,3]. The bitwise XOR of all these numbers is 13, so we return 13. ``` **Example 2:** ``` **Input:** nums1 = [1,2], nums2 = [3,4] **Output:** 0 **Explanation:** All possible pairs of bitwise XORs are nums1[0] ^ nums2[0], nums1[0] ^ nums2[1], nums1[1] ^ nums2[0], and nums1[1] ^ nums2[1]. Thus, one possible nums3 array is [2,5,1,6]. 2 ^ 5 ^ 1 ^ 6 = 0, so we return 0. ``` **Constraints:** `1 <= nums1.length, nums2.length <= 105` `0 <= nums1[i], nums2[j] <= 109`",
    "public_test_cases": [
        {
            "label": "Example 1",
            "input": "nums1 = [2,1,3], nums2 = [10,2,5,0]",
            "output": "13 "
        },
        {
            "label": "Example 2",
            "input": "nums1 = [1,2], nums2 = [3,4]",
            "output": "0 "
        }
    ],
    "private_test_cases": [],
    "haskell_template": "xorAllNums :: [Int] -> [Int] -> Int\nxorAllNums nums1 nums2 ",
    "ocaml_template": "let xorAllNums (nums1: int list) (nums2: int list) : int =  ",
    "scala_template": "def xorAllNums(nums1: List[Int],nums2: List[Int]): Int = { \n    \n}",
    "java_template": "public static int xorAllNums(List<Integer> nums1, List<Integer> nums2) {\n\n}",
    "python_template": "class Solution(object):\n    def xorAllNums(self, nums1, nums2):\n        \"\"\"\n        :type nums1: List[int]\n        :type nums2: List[int]\n        :rtype: int\n        \"\"\"\n        "
}