Function merge_arrays

Source
pub fn merge_arrays(arr1: &[i32], arr2: &[i32]) -> Vec<i32>
Expand description

You are given two sorted arrays that contain only integers. These arrays may be sorted in either ascending or descending order. Your task is to merge them into a single array, ensuring that: The resulting array is sorted in ascending order. Any duplicate values are removed, so each integer appears only once. If both input arrays are empty, return an empty array. No input validation is needed, as both arrays are guaranteed to contain zero or more integers.

ยงExample

[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]
returns [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]