Minimum XOR

Three integers L, R, and X are given. Find a number N within the range [L, R] that minimizes N ^ X. If multiple values give the same minimum XOR, return the smallest N.

Examples
Input: [2,7,5]
Output: 5
Hints

Minimum XOR

Three integers `L`, `R`, and `X` are given. Find a number `N` within the range `[L, R]` that minimizes `N ^ X`. If multiple values give the same minimum XOR, return the smallest `N`.