Difficulty Level: Basic

Submissions: 4771 Accuracy:


Remove duplicate elements from sorted Array (Function Problem)

Given a sorted array, your task to complete the function remove_duplicate which removes the duplicate  elements from the array .
The function remove_duplicate takes two arguments . The first argument is the sorted array A[ ] and the second argument is 'N' the size of the array and returns the size of the new converted array A[ ] with no duplicate element .

Input  :
The first line of input contains T denoting the no of test cases . Then T test cases follow . The first line of each test case contains an Integer N and the next line contains N space separated values of the array A[ ] .

For each test case output will be the transformed array with no duplicates.

1<=A[ ] <=100


Input  (To be used only for expected output) :
2 2 2 2 2 
1 2 2

1 2

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Amit Khandelwal
Author: Shubham Joshi 1

It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use, generate link and share the link here.