Single Number

来源:互联网 发布:南风知我意微盘 编辑:程序博客网 时间:2024/06/05 11:33

tips:按位异或,0与0(1)异或结果还是0(1)

public class Solution {    public int singleNumber(int[] A) {        int result = 0;            for(int j = 0; j < A.length; j++){                result = result ^ A[j];            }        return result;    }}
0 0
原创粉丝点击