Minimum Array End

Construct an array of length n whose bitwise AND of all elements equals x, while minimizing the last element. The solution encodes the binary representation of n-1 into the zero-bit positions of x.

Examples
Input: [3,4]
Output: 6
Hints

Minimum Array End

Construct an array of length `n` whose bitwise AND of all elements equals `x`, while minimizing the last element. The solution encodes the binary representation of `n-1` into the zero-bit positions of `x`.