You are viewing a single comment's thread. Return to all comments →
Scala
def sockMerchant(n: Int, ar: Array[Int]): Int = { val distinctSocks = ar.distinct var pairs: Int = 0 for(i <- distinctSocks) { pairs+= (ar.count(_==i))/2 } pairs }
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 →
Scala