Tap here to switch tabs
Problem
Submissions

Problem: Find the XOR of Numbers Which Appear Twice

med
30 min
Try to solve the Find the XOR of Numbers Which Appear Twice problem.

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

med
30 min
Try to solve the Find the XOR of Numbers Which Appear Twice problem.

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.