Remove duplicates in small prime array
Easy Accuracy: 37.25% Submissions: 7876 Points: 2

Given an array consisting of only prime numbers, remove all duplicate numbers from it. 
Note: Retain the first occurrence of the duplicate element.

Example 1:

Input:
N = 6
A[] = {2,2,3,3,7,5}
Output: 2 3 7 5
Explanation: After removing the duplicate
2 and 3 we get 2 3 7 5.

Your Task:
Complete the function removeDuplicate() that takes given array and N as input parameters and returns modified array which has no duplicates.

Note: In case of cpp the return type is vector<int>

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

Constraints:
1<=N=1000
2<=A[i]<100

to report an issue on this page.

Editorial

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

Yes

All Submissions

My Submissions:

Login to access your submissions.