We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Permuting Two Arrays
- Discussions
Permuting Two Arrays
Permuting Two Arrays
Sort by
recency
|
130 Discussions
|
Please Login in order to post a comment
Hey folks, I solved this problem by sorting the arrays A and B, ascending and descending, then checking the addition of those values by index with k. Please help me with some other alternative solutions, if any. Here is my code in javascript,
The explantion is wrong. The index in B should be 0
WRONG: A[0] + B[1] = 1 + 9 = 10 >= k
RIGHT: A[0] + B[0] = 1 + 9 = 10 >= k
//Can't find any better solution
def twoArrays(k, A, B):
kotlin