Sorting after Difference | O(n*log(n))
Complexity\n- Time complexity: O(n*log(n))\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n) extra space\n Add your space complexity here,
# Complexity\n- Time complexity: $$O(n*log(n))$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$ $$extra$$ $$space$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\npub fn mice_and_cheese(r1: Vec<i32>, r2: Vec<i32>, mut k: i32) -> i32 {\n    let n = r1.len();\n    let (mut left, mut right, mut points) = (0, n - 1, 0);\n    let mut diff: Vec<_> = (0..n).map(|i| (r1[i] - r2[i], i)).collect();\n    diff.sort_by(|a, b| b.cmp(&a));\n    \n    while k > 0 && left < right + 1 {\n        points += r1[diff[left].1];\n        left += 1;\n        k -= 1;\n    }\n\n    while left < right + 1 {\n        points += r2[diff[right].1];\n        right -= 1;\n    }\n\n    points\n}\n```
['Rust']