Join Slack
Powered by
is there a one-liner for this? the bulk of the cou...
# getting-started
o
oday
12/18/2019, 5:55 PM
is there a one-liner for this? the bulk of the counting pairs part of the problem I mean, not the end aggregation (but also there as well)
r
Ruckus
12/18/2019, 6:05 PM
Copy code
fun sockMerchant(n: Int, ar: IntArray) = ar.groupBy { it }.values.sumBy { it.size / 2 }
💯 2
o
oday
12/18/2019, 6:34 PM
yea gussed as muc
oday
12/18/2019, 6:34 PM
thank you very much
2
Views
Open in Slack
Previous
Next