top of page

### Looking to master object-oriented and system design for tech interviews or career growth?

• Improve your system design and machine coding skills.

• Study with our helpful resources.

**We're in beta mode and would love to hear your feedback.

Search

# XOR-ing the Subarrays! - InterviewBit Solution

Problem: XOR-ing the Subarrays!

Problem Description

Given an integer array A of size N. You need to find the value obtained by XOR-ing the contiguous subarrays, followed by XOR-ing the values thus obtained. Determine and return this value. For example, if A = [3, 4, 5] :

```Subarray    Operation   Result
3       None            3
4       None            4
5       None            5
3,4   3 XOR 4         7
4,5   4 XOR 5         1
3,4,5    3 XOR 4 XOR 5   2```

Problem Constraints

```1 <= N <= 105
1 <= A[i] <= 108```

Input Format

The first and only argument is an integer array A.

Output Format

Return a single integer denoting the value as described above.

### Solution in CPP:

If you have any questions or queries, feel free to drop a comment in the comments section below.