题目:
题解:
int* grayCode(int n, int* returnSize) {
int ret_size = 1 << n;
int *ret = (int *)malloc(ret_size * sizeof(int));
for (int i = 0; i < ret_size; i++) {
ret[i] = (i >> 1) ^ i;
}
*returnSize = ret_size;
return ret;
}