Determining numbers
Practice
0 (0 votes)
Basic programming
Bit manipulation
Basics of bit manipulation
Bit manipulation
Xor
Problem
70% Success 30 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given an array of integers. The special property of the array is that exactly two different elements occur once while other elements occur twice.

You are required to determine those two elements.

Input format

  • First line: Integer \(N\) denoting the number of elements in the array
  • Second line: \(N\) space-separated integers denoting the values in the array

Output format

Print two space-separated integers that occur once in the array in ascending order.

Constraints

\(1 \leq N \leq 10^6\)

\(1 \leq A_i \leq 10^6\), where \(A_i\) denotes the \(i_{th}\) element in the array

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
Tags:
Medium-Hard
Points:20
131 votes
Tags:
Ad-HocBasic ProgrammingEasy
Points:50
19 votes
Tags:
Dynamic ProgrammingApprovedMedium-HardString