Tap here to switch tabs
Problem
Submissions

Problem: Make the XOR of All Segments Equal to Zero

Make the XOR of All Segments Equal to Zero asks you to modify as few array elements as possible so every contiguous segment of length k has XOR zero.

Statement

You are given an integer array nums and an integer k.

The bitwise XOR{XOR} of a contiguous segment of length k is the bitwise XOR{XOR} of all elements in that segment.

Return the minimum number of elements you need to modify in nums such that the bitwise XOR{XOR} of every contiguous segment of length k is equal to 00.

Constraints:

  • 1≤1 \leq k ≤\leq nums.length ≤2000\leq 2000

  • 0≤0 \leq nums[i] <210< 2^{10}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make the XOR of All Segments Equal to Zero

Make the XOR of All Segments Equal to Zero asks you to modify as few array elements as possible so every contiguous segment of length k has XOR zero.

Statement

You are given an integer array nums and an integer k.

The bitwise XOR{XOR} of a contiguous segment of length k is the bitwise XOR{XOR} of all elements in that segment.

Return the minimum number of elements you need to modify in nums such that the bitwise XOR{XOR} of every contiguous segment of length k is equal to 00.

Constraints:

  • 1≤1 \leq k ≤\leq nums.length ≤2000\leq 2000

  • 0≤0 \leq nums[i] <210< 2^{10}