You are given a non-decreasing array nums and an integer maximumBit. For each query, choose an integer k in the range 0 <= k < 2^maximumBit that maximizes the bitwise XOR of k with every value currently in the array. Record this k, then remove the last array element. Repeat until the array is empty, and return the recorded values in query order.
Example 1:
Input: nums = [1,2]
maximumBit = 2
Output: [0,2]Explanation: The XOR of [1,2] is 3, so k = 0 gives the maximum possible result 3. Remove 2; the remaining XOR is 1, so k = 2 makes the result 3. The answers are [0,2].
Example 2:
Input: nums = [0]
maximumBit = 1
Output: [1]Explanation: The current XOR is 0. Choosing k = 1 gives result 1, the largest possible with one bit.
Example 3:
Input: nums = [1,1,1]
maximumBit = 1
Output: [0,1,0]Explanation: The successive array XORs are 1, 0, and 1. Choosing k values 0, 1, and 0 makes each result equal to 1.
Constraints:
1 <= nums.length <= 1000001 <= maximumBit <= 200 <= nums[i] < 2^maximumBitnumsis sorted in non-decreasing order.