Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1787. Make the XOR of All Segments Equal to Zero
Given an array nums and integer k, find the minimum number of element changes so that every contiguous subarray of length k has XOR equal to zero. Key insight: indices partition into k residue classes (by index mod k), and you choose values for each class to make their XOR zero while minimizing edits — typically solved by DP over XOR states using frequency counts (value domain < 2^10).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.