Search
⌘K

Leetcode 1829. Maximum XOR for Each Query

Given an array and a bit-width, for each query (removing the last element each time) find k < 2^maximumBit that maximizes the XOR of all current elements with k. This reduces to maintaining the cumulative XOR of the array and returning k as its bitwise complement under the mask (2^maximumBit - 1) for each step.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.