|
| 1 | +<p>You are given two <strong>0-indexed</strong> arrays, <code>nums1</code> and <code>nums2</code>, consisting of non-negative integers. There exists another array, <code>nums3</code>, which contains the bitwise XOR of <strong>all pairings</strong> of integers between <code>nums1</code> and <code>nums2</code> (every integer in <code>nums1</code> is paired with every integer in <code>nums2</code> <strong>exactly once</strong>).</p> |
| 2 | + |
| 3 | +<p>Return<em> the <strong>bitwise XOR</strong> of all integers in </em><code>nums3</code>.</p> |
| 4 | + |
| 5 | +<p> </p> |
| 6 | +<p><strong class="example">Example 1:</strong></p> |
| 7 | + |
| 8 | +<pre> |
| 9 | +<strong>Input:</strong> nums1 = [2,1,3], nums2 = [10,2,5,0] |
| 10 | +<strong>Output:</strong> 13 |
| 11 | +<strong>Explanation:</strong> |
| 12 | +A possible nums3 array is [8,0,7,2,11,3,4,1,9,1,6,3]. |
| 13 | +The bitwise XOR of all these numbers is 13, so we return 13. |
| 14 | +</pre> |
| 15 | + |
| 16 | +<p><strong class="example">Example 2:</strong></p> |
| 17 | + |
| 18 | +<pre> |
| 19 | +<strong>Input:</strong> nums1 = [1,2], nums2 = [3,4] |
| 20 | +<strong>Output:</strong> 0 |
| 21 | +<strong>Explanation:</strong> |
| 22 | +All possible pairs of bitwise XORs are nums1[0] ^ nums2[0], nums1[0] ^ nums2[1], nums1[1] ^ nums2[0], |
| 23 | +and nums1[1] ^ nums2[1]. |
| 24 | +Thus, one possible nums3 array is [2,5,1,6]. |
| 25 | +2 ^ 5 ^ 1 ^ 6 = 0, so we return 0. |
| 26 | +</pre> |
| 27 | + |
| 28 | +<p> </p> |
| 29 | +<p><strong>Constraints:</strong></p> |
| 30 | + |
| 31 | +<ul> |
| 32 | + <li><code>1 <= nums1.length, nums2.length <= 10<sup>5</sup></code></li> |
| 33 | + <li><code>0 <= nums1[i], nums2[j] <= 10<sup>9</sup></code></li> |
| 34 | +</ul> |
0 commit comments