题目描述
Given an array of integers which may or may not contain duplicate elements. Your task is to removing duplicate elements, if present.
Example 1:
Input:
N = 6
A[] = {1, 2, 3, 1, 4, 2}
Output:
1 2 3 4
Example 2:
Input:
N = 4
A[] = {1, 2, 3, 4}
Output:
1 2 3 4
Your Task:
You don't need to read input or print anything. Your task is to complete the function removeDuplicate() which takes the array A[] and its size N as inputs and returns an array with no duplicate element present, in the same order as input.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
Constraints:
1<=N<=10^{5}
1<=A[i]<=10^{5}
输入格式
见题面
输出格式
见题面
样例输入
N = 6
A[] = {1, 2, 3, 1, 4, 2}
样例输出
1 2 3 4