Maximum XOR Per Query

Given a sorted array and a bit limit, perform a series of queries. For each query, take the XOR of the remaining prefix, then find the integer x less than 2^maximumBit that maximizes the XOR with that prefix result. Return the optimal x for each query in order, processing from the full array down to a single element.

Examples
Input: [[0,1,1,3],2]
Output: [0,3,2,3]
Hints

Maximum XOR Per Query

Given a sorted array and a bit limit, perform a series of queries. For each query, take the XOR of the remaining prefix, then find the integer `x` less than `2^maximumBit` that maximizes the XOR with that prefix result. Return the optimal `x` for each query in order, processing from the full array down to a single element.