136. Single Number

来源:互联网 发布:网易对战平台mac版 编辑:程序博客网 时间:2024/05/04 13:22

Given an array of integers, every element appears twice except for one. Find that single one.

public class _136 {    public static void main(String[] args) {        int[] nums = {1,2,3,2,5,99,4,5,99,4,1};        int flag = 0;        for (int i = 0; i < nums.length; i++) {            flag = flag ^ nums[i];        }        System.out.println(flag);    }}
0 0
原创粉丝点击