Given a int[] values, return a int[] of the same size where the k-th element is an integer X such that low <= X <= high and the bit difference between X and values[k] is minimal. If there are multiple such int[]s, return the one that comes first lexicographically. A int[] a1 comes before a int[] a2 lexicographically if a1 has a lower value at the first position where they differ.
To calculate the bit difference between two integers, first convert them to their binary representations. If their binary representations have different lengths, pad the shorter one with 0's on the left until they both have the same length. The bit difference is the number of positions where the two binary representations differ.
|