File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed
src/algorithm_practice/Array_Algorithms/sockMerchant Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change 11#include < iostream>
22
3- using namespace std ;
4-
53// Source: https://www.hackerrank.com/challenges/sock-merchant
64
75/* *
@@ -22,18 +20,18 @@ using namespace std;
2220int main () {
2321 int n, tmpItem;
2422 int list[101 ] = {0 };
25- cin >> n;
23+ std:: cin >> n;
2624 for (int i = 0 ; i < n; ++i) {
27- cin >> tmpItem;
25+ std:: cin >> tmpItem;
2826 list[tmpItem]++;
2927 }
3028
3129 int totalPairs = 0 ;
32- for (int i = 0 ; i < 101 ; ++i) {
33- totalPairs += list[i]/ 2 ;
30+ for (int i = 1 ; i < 101 ; ++i) {
31+ totalPairs += list[i] / 2 ;
3432 }
3533
36- cout << totalPairs << endl;
34+ std:: cout << totalPairs << std:: endl;
3735
3836 return 0 ;
3937}
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments