Max XOR With Element From Array

You are given an array nums of non-negative integers and a list of queries. Each query contains a number x and a limit m. For each query, find the maximum XOR of x with any element from nums that is ≤ m. If no such element exists, return -1. Queries are answered offline by sorting and using a binary trie.

Examples
Input: []
Output: 0

Max XOR With Element From Array

You are given an array nums of non-negative integers and a list of queries. Each query contains a number x and a limit m. For each query, find the maximum XOR of x with any element from nums that is ≤ m. If no such element exists, return -1. Queries are answered offline by sorting and using a binary trie.