1787. Make the XOR of All Segments Equal to Zero
https://leetcode.com/problems/make-the-xor-of-all-segments-equal-to-zero
Description
You are given an array nums
and an integer k
. The XOR of a segment [left, right]
where left <= right
is the XOR
of all the elements with indices between left
and right
, inclusive: nums[left] XOR nums[left+1] XOR ... XOR nums[right]
.
Return the minimum number of elements to change in the array such that the XOR
of all segments of size k
is equal to zero.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= k <= nums.length <= 2000
0 <= nums[i] < 210
ac
Previous1786. Number of Restricted Paths From First to Last NodeNext1788. Maximize the Beauty of the Garden
Last updated