在数组中查找出只出现过一次的数字(C语言)
1 int SearchSingleNum(int *num, int size) 2 { 3 int i = 0; 4 int tmp = 0; 5 int iRt = 0; 6 7 for (i = 0; i < size; i++) { 8 iRt = ~tmp & (iRt ^ num[i]); 9 tmp = ~iRt & (tmp ^ num[i]); 10 } 11 return iRt; 12 }
1 int SearchSingleNum(int *num, int size) 2 { 3 int i = 0; 4 int tmp = 0; 5 int iRt = 0; 6 7 for (i = 0; i < size; i++) { 8 iRt = ~tmp & (iRt ^ num[i]); 9 tmp = ~iRt & (tmp ^ num[i]); 10 } 11 return iRt; 12 }