Sale
Summer Offer: $190/yr $99/yr
00 : 00 : 00 : 00
Get this deal
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

Trusted by 100+ professionals preparing for interviews

Trusted by 100+ professionals 50+ Company Question Banks 5+ Supported Languages

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

Get Started Free
Link copied to clipboard