Determining numbers
Practice
4.3 (46 votes)
Basic programming
Bit manipulation
Bit manipulation
Problem
86% Success 15020 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:10
80 votes
Tags:
Bit manipulationBit ManipulationBasics of Bit ManipulationBasic Programming
Points:10
163 votes
Tags:
Bit manipulationEasyReady
Points:10
4 votes
Tags:
Basic MathBasic ProgrammingBasics of bit manipulationBit ManipulationBasics of Bit Manipulation