MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / missingNumber

Method missingNumber

268-missing-number/missing-number.java:4–13  ·  view source on GitHub ↗
(int[] nums)

Source from the content-addressed store, hash-verified

2
3class Solution {
4 public int missingNumber(int[] nums) {
5 int xor = 0;
6 for (int i = 0; i <= nums.length; i++) {
7 xor ^= i;
8 }
9 for (int num : nums) {
10 xor ^= num;
11 }
12 return xor;
13 }
14}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected