Available question text
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.
Related questions
Continue with questions that share topics or the same question type.
- Given an array nums and a sliding window of size k moving from the very left to the very right, return the maximum value in the window for each position. Solve in O(n) time using a deque.
Coding
- Maximum XOR of Two Numbers in an Array
Coding
- Partition Array for Maximum XOR and AND
Coding
- Removing Minimum and Maximum From Array
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1707. Maximum XOR With an Element From Array
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source