Company: Cashfree_6nov
Difficulty: medium
Subarray XOR Sum Problem Description Given an array of integers, find the sum of the bitwise XOR sums of each of its subarrays. The bitwise XOR sum of a subarray [L, R] is defined as arr[L] ^ arr[L+1] ^ ... ^ arr[R] , where ^ denotes the bitwise XOR operation. Function Description: Complete the function getLongXorSum in the editor below. getLongXorSum has the following parameter: int arr[] : an array of integers Returns: long int : the sum of XOR sums of all subarrays Examples Example 1: Input: arr = [1, 2, 3] Output: 10 Explanation: The subarrays along with their xor sums are shown. [1] = 1 [2] = 2 [3] = 3 [1, 2] = 1 ^ 2 = 3 [2, 3] = 2 ^ 3 = 1 [1, 2, 3] = 1 ^ 2 ^ 3 = 0 Sum of XOR sums = 1 + 2 + 3 + 3 + 1 + 0 = 10 . Example 2: Input: arr = [2, 4, 6, 7] Output: 48 Explanation: The xor sums are shown. [2] = 2 [4] = 4 [6] = 6 [7] = 7 [2, 4] = 2 ^ 4 = 6 [4, 6] = 4 ^ 6 = 2 [6, 7] = 6 ^ 7 = 1 [2, 4, 6] = 2 ^ 4 ^ 6 = 0 [4, 6, 7] = 4 ^ 6 ^ 7 = 3 [2, 4, 6, 7] = 2 ^ 4 ^ 6 ^ 7 = 7 Constraints 1 0