For each x in queries, return the maximum of x ^ n over all numbers n in nums (^ is xor). nums is not empty.
For nums = [0, 1, 2, 3, 4] and queries = [3, 5] the answer is [7, 7].
The starter code tries every number for every query. It is correct but too slow for many numbers and queries.
Example 1
Input:
max_xor_queries([0, 1, 2, 3, 4], [3, 5])
Output:
[7, 7]
Example 2
Input:
max_xor_queries([7], [7, 0])
Output:
[0, 7]
1 <= len(nums) <= 150000 <= len(queries) <= 150000 <= nums[i], x < 2**30No results yet
Run your code to check it against the examples, or submit to run every test.