标签:
public class Solution { public int missingNumber(int[] nums) { int n = 0; for (int num : nums) { n = Math.max(n, num); } int result = 0; for (int i = 0; i < nums.length; i++) { result ^= nums[i]; } for (int i = 0; i <= n; i++) { result ^= i; } if (n == nums.length - 1) { return n + 1; } else { return result; } } }
标签:
原文地址:http://www.cnblogs.com/vision-love-programming/p/5002796.html