两数交换
@org.junit.Test
public void fun1(){
int a = 1 , b = 2;
a = a ^ b;
b = a ^ b;
a = a ^ b;
System.out.println(a + " , " + b);
}
查找出现奇数次的字符
image.png @org.junit.Test
public void fun2(){
int e0 = 0;
char[] chars = {'A', 'D', 'C', 'B', 'A', 'C', 'D'};
for(char ch : chars)
e0 ^= ch;
System.out.printf("%c", e0);
}
布隆过滤器
略
网友评论