Tap here to switch tabs
Problem
Submissions

Problem: Maximum XOR After Operations

Maximum XOR After Operations lets you repeatedly replace any array element with its bitwise AND with its XOR against a chosen nonnegative integer. Return the largest XOR of all elements achievable.

Statement

You are given a 00 indexed integer array nums. In a single operation, you may select any non negative integer x and an index i, and update nums[i] to nums[i] AND (nums[i] XOR x).

You may perform this operation any number of times on any indices.

Return the maximum possible bitwise XOR sum of all elements in nums after applying the operation any number of times.

Constraints:

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

  • 0≤0 \leq nums[i] ≤108\leq 10^8

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum XOR After Operations

Maximum XOR After Operations lets you repeatedly replace any array element with its bitwise AND with its XOR against a chosen nonnegative integer. Return the largest XOR of all elements achievable.

Statement

You are given a 00 indexed integer array nums. In a single operation, you may select any non negative integer x and an index i, and update nums[i] to nums[i] AND (nums[i] XOR x).

You may perform this operation any number of times on any indices.

Return the maximum possible bitwise XOR sum of all elements in nums after applying the operation any number of times.

Constraints:

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

  • 0≤0 \leq nums[i] ≤108\leq 10^8