You are viewing a single comment's thread. Return to all comments →
public static int sockMerchant(int n, List ar) { int pairCount = 0; Dictionary DictionaryObj = new Dictionary();
foreach (var item in ar) { if (DictionaryObj.ContainsKey(item)) { DictionaryObj[item]++; } else { DictionaryObj[item] = 1; } } foreach (int count in DictionaryObj.Values) { pairCount += count / 2; } return pairCount; }****
Seems like cookies are disabled on this browser, please enable them to open this website
Sales by Match
You are viewing a single comment's thread. Return to all comments →
public static int sockMerchant(int n, List ar) { int pairCount = 0; Dictionary DictionaryObj = new Dictionary();