a********r 发帖数: 218 | 1 complete a function as follows:
int getClosest(int x)
{
}
The output must be smaller than the input integer but closest to the input
integer AND the output integer and the input integer must contain same 1's.
For example, if the input is 5, it binary representation is 0101, so the
answer will be 0011 (it is 3) because 3 < 5 and both have two 1's | h**********l 发帖数: 6342 | 2 150原体啊
.
【在 a********r 的大作中提到】 : complete a function as follows: : int getClosest(int x) : { : } : The output must be smaller than the input integer but closest to the input : integer AND the output integer and the input integer must contain same 1's. : For example, if the input is 5, it binary representation is 0101, so the : answer will be 0011 (it is 3) because 3 < 5 and both have two 1's
|
|