Skip to content

Commit 1acc13a

Browse files
authored
Create Sock Merchant.cpp
1 parent f566801 commit 1acc13a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Hackerrank/Sock Merchant.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Problem Link: https://www.hackerrank.com/challenges/sock-merchant/copy-from/114501869
2+
#include <bits/stdc++.h>
3+
4+
using namespace std;
5+
int main()
6+
{
7+
8+
int n,a[101]={0},i,k,sum=0;
9+
cin >> n;
10+
11+
for(i=0;i<n;i++)
12+
{
13+
cin>>k;
14+
a[k]++;
15+
}
16+
17+
for(i=0;i<=100;i++)
18+
{
19+
sum+=a[i]/2;
20+
}
21+
cout<<sum<<endl;
22+
}

0 commit comments

Comments
 (0)