Missing Number XOR Problem
Missing Number XOR Problem — ExecCode Easy DSA Practice
Solve the Missing Number XOR problem on ExecCode. Free online easy DSA practice in Bit Manipulation. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Given an array nums containing n distinct numbers taken from the range [0, n], return the one number in that range that is missing from the array, using XOR instead of extra memory.
Examples
Input nums = [3, 0, 1]; Output 2. Input nums = [0, 1]; Output 2. Input nums = [9, 6, 4, 2, 3, 5, 7, 0, 1]; Output 8
Constraints
n == nums.length 1 <= n <= 100000 0 <= nums[i] <= n All values in nums are distinct
Practice Missing Number XOR free on ExecCode. Browse DSA problems, topic map, and placement guides.