Skip to content

Commit 1d60092

Browse files
authored
Create Tree2.cpp
1 parent abd9d10 commit 1d60092

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Tree2.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <iostream>
2+
#include<algorithm>
3+
using namespace std;
4+
5+
int main() {
6+
// your code goes here
7+
int t;
8+
cin>>t;
9+
10+
while(t--){
11+
int n;
12+
cin>>n;
13+
int arr[n];
14+
15+
for(int i=0;i<n;i++){
16+
int a;
17+
cin>>a;
18+
arr[i]=a;
19+
}
20+
21+
sort(arr,arr+n);
22+
int count=0;
23+
for(int i=0;i<n-1;i++){
24+
if(arr[i]!=arr[i+1]){
25+
count++;
26+
}
27+
}
28+

0 commit comments

Comments
 (0)