Search
⌘K

Leetcode 2317. Maximum XOR After Operations

Recognize that the operation can clear any subset of 1-bits in any element, so for each bit position you can make that bit appear in the final XOR iff it appears in at least one input number; therefore the maximum possible XOR is simply the bitwise OR of all elements.


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.