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.
- Prepare
- Algorithms
- Greedy
- Permuting Two Arrays
- Discussions
Permuting Two Arrays
Permuting Two Arrays
Sort by
recency
|
349 Discussions
|
Please Login in order to post a comment
Java:
Here is my c++ solution, you can watch the vidéo explanation here : https://youtu.be/JQQV9IZlz7g
My Java solution with o(n log n) time complexity and o(1) space complexity:
C++ solution ==========>>>>>>>>>>>>>
string twoArrays(int k, vector A, vector B) { if(A.size() != B.size()) { return "NO"; } int n = A.size(); sort(A.begin(), A.end()); sort(B.begin(), B.end(), greater());
}
Here is my Python solution!