Tap here to switch tabs
Problem
Submissions

Problem: Find Xor-Beauty of Array

med
30 min
Try to solve the Find Xor-Beauty of Array problem.

Statement

Given a 00 indexed integer array nums.

The effective value of a triplet of indices (i, j, k) is calculated as ((nums[i] | nums[j]) & nums[k]).

The XOR beauty of the array is defined as the bitwise XOR sum of the effective values of all possible index triplets (i, j, k) satisfying 0≤0 \leq i, j, k << nums.length.

Return the XOR beauty of nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Xor-Beauty of Array

med
30 min
Try to solve the Find Xor-Beauty of Array problem.

Statement

Given a 00 indexed integer array nums.

The effective value of a triplet of indices (i, j, k) is calculated as ((nums[i] | nums[j]) & nums[k]).

The XOR beauty of the array is defined as the bitwise XOR sum of the effective values of all possible index triplets (i, j, k) satisfying 0≤0 \leq i, j, k << nums.length.

Return the XOR beauty of nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9