You are viewing a single comment's thread. Return to all comments →
Rust best solution If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions
pub fn permuting_two_arrays(k: i32, A: &[i32], B: &[i32]) -> String { //Time complexity: O(n*log(n)) //Space complexity (ignoring input): O(n) let mut A = A.to_vec(); A.sort_unstable(); let mut B = B.to_vec(); B.sort_unstable_by(|x, y| y.cmp(x)); for (index, a_value) in A.iter().enumerate() { let b_value = B[index]; if a_value + b_value < k { return "NO".to_string(); } } "YES".to_string() }
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 →
Rust best solution
If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions