You are viewing a single comment's thread. Return to all comments →
Kotlin
fun pairs(k: Int, arr: Array<Int>): Int { arr.sort() val valueSet = arr.toHashSet() var counter = 0 for (i in arr.size - 1 downTo 0) { if ((arr[i] - k) in valueSet) { counter++ } } return counter }
Seems like cookies are disabled on this browser, please enable them to open this website
Pairs
You are viewing a single comment's thread. Return to all comments →
Kotlin