Tap here to switch tabs
Problem
Submissions

Problem: Minimum Removals to Achieve Target XOR

Minimum Removals to Achieve Target XOR gives an array and target. Find minimum removals so the rest has the target XOR, or return negative one.

Statement

Given an integer array nums and an integer target, determine the minimum number of elements that must be removed from nums so that the bitwise XOR sum of the remaining elements is equal to target.

Return the minimum number of removals required. If it is impossible to achieve a bitwise XOR sum equal to target, return −1-1.

Constraints:

  • 1≤1 \leq nums.length ≤40\leq 40

  • 0≤0 \leq nums[i] ≤104\leq 10^4

  • 0≤0 \leq target ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Removals to Achieve Target XOR

Minimum Removals to Achieve Target XOR gives an array and target. Find minimum removals so the rest has the target XOR, or return negative one.

Statement

Given an integer array nums and an integer target, determine the minimum number of elements that must be removed from nums so that the bitwise XOR sum of the remaining elements is equal to target.

Return the minimum number of removals required. If it is impossible to achieve a bitwise XOR sum equal to target, return −1-1.

Constraints:

  • 1≤1 \leq nums.length ≤40\leq 40

  • 0≤0 \leq nums[i] ≤104\leq 10^4

  • 0≤0 \leq target ≤104\leq 10^4