You are viewing a single comment's thread. Return to all comments →
kotlin
val n: Int = A.size var _A = Array(n){0} var _B = Array(n){0} A.sort() B.sort() for (i in 0..n-1) { for (j in 0..n-1) { if (A[i] + B[j] >= k && _A[i] == 0 && _B[j] == 0) { _A[i] = 1 _B[j] = 1 break } } } if (_A.sum() == n && _B.sum() == n) return "YES" return "NO"
Seems like cookies are disabled on this browser, please enable them to open this website
Permuting Two Arrays
You are viewing a single comment's thread. Return to all comments →
kotlin