MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / xorAllNums

Method xorAllNums

BitwiseXOROfAllPairings.java:2–18  ·  view source on GitHub ↗
(int[] nums1, int[] nums2)

Source from the content-addressed store, hash-verified

1class Solution {
2 public int xorAllNums(int[] nums1, int[] nums2) {
3 // n + m
4 int n = nums1.length;
5 int res=0;
6 if(n%2!=0){
7 for(int num : nums2){
8 res^=num;
9 }
10 }
11 int m = nums2.length;
12 if(m%2!=0){
13 for(int num : nums1){
14 res^=num;
15 }
16 }
17 return res;
18 }
19}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected