Even occurring elements
Basic Accuracy: 26.67% Submissions: 15 Points: 1

Given an array Arr of N integers that contains odd number of occurrences for all numbers except for a few elements which are present even number of times. Find the elements which have even occurrences in the array.

Example 1:

N = 11
Arr[] = {9, 12, 23, 10, 12, 12, 
15, 23, 14, 12, 15}
Output: 12 15 23

Example 2:

N = 5
Arr[] = {23, 12, 56, 34, 32}
Output: -1
Explanation: Every integer is present odd 
number of times.

Your Task:
You don't need to read input or print anything. Your task is to complete the function repeatingEven() which takes the array of integers arr and its size as input parameters and returns a sorted array denoting the answer. If no such even occuring element is present return -1.

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

1 ≤ N ≤ 105
0 ≤ Arr[i] ≤ 63

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.