Tap here to switch tabs
Problem
Submissions

Problem: Find the XOR of Numbers Which Appear Twice

Find the XOR of Numbers Which Appear Twice asks you to inspect an array of integers, where each value appears once or twice, and return the bitwise XOR of repeated values, or zero if none repeat.

Statement

You are given an array nums consisting of positive integers, where every integer appears either once or twice.

Return the bitwise XOR of all elements that appear twice in nums. If no number appears twice, return 00.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 1≤1 \leq nums[i] ≤50\leq 50

  • Each number in nums appears either once or twice.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the XOR of Numbers Which Appear Twice

Find the XOR of Numbers Which Appear Twice asks you to inspect an array of integers, where each value appears once or twice, and return the bitwise XOR of repeated values, or zero if none repeat.

Statement

You are given an array nums consisting of positive integers, where every integer appears either once or twice.

Return the bitwise XOR of all elements that appear twice in nums. If no number appears twice, return 00.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 1≤1 \leq nums[i] ≤50\leq 50

  • Each number in nums appears either once or twice.