Backend Engineer
Senior
programming
Implement a function to sort an array using the Merge Sort algorithm. The function should return the sorted array. Example 1: Input: arr = [38, 27, 43, 3, 9, 82, 10] Output: [3, 9, 10, 27, 38, 43, 82] Example 2: Input: arr = [5, 1, 4, 2, 8] Output: [1, 2, 4, 5, 8] Constraints: - 1 <= arr.length <= 10^6 - -10^6 <= arr[i] <= 10^6.
Suggested Answer