Search
⌘K

Leetcode 1707. Maximum XOR With an Element From Array

For each query [x, m], return the maximum value of x XOR nums[j] over all nums[j] ≤ m (or -1 if no such element). The typical efficient approach is to process queries offline by increasing m and maintain a binary XOR trie of eligible nums (values up to ~2^30) to answer each max-XOR query quickly.


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.