✅💯🔥Simple Code📌🚀| 🔥✔️Easy to understand🎯 | 🎓🧠Beginner friendly🔥| O(N logN) Time Comp.💀💯
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] sortArray(int[] nums) {\n        divide(nums, 0, nums.length - 1);\n        return nums;\n    }\n\n    public void divide(int[] nums, int si, int ei) {\n        if (si >= ei) {\n            return;\n        }\n        int mid = si + (ei - si) / 2;\n        divide(nums, si, mid);\n        divide(nums, mid + 1, ei);\n        mergesort(nums, si, ei, mid);\n    }\n\n    public void mergesort(int[] nums, int si, int ei, int mid) {\n        int[] newArr = new int[ei - si + 1];\n        int i = si;\n        int j = mid + 1;\n        int k = 0;\n        while (i <= mid && j <= ei) {\n            if (nums[i] <= nums[j]) {\n                newArr[k] = nums[i];\n                i++; k++;\n            } else {\n                newArr[k] = nums[j];\n                j++; k++;\n            }\n        }\n        while (i <= mid) {\n            newArr[k] = nums[i];\n            i++; k++;\n        }\n        while (j <= ei) {\n            newArr[k] = nums[j];\n            j++; k++;\n        }\n        for (int l = 0; l < newArr.length; l++) {\n            nums[si + l] = newArr[l];\n        }\n    }\n}\n\n```\n![7be995b4-0cf4-4fa3-b48b-8086738ea4ba_1699897744.9062278.jpeg](https://assets.leetcode.com/users/images/fe5117c9-43b1-4ec8-8979-20c4c7f78d98_1721303757.4674635.jpeg)
['Array', 'Divide and Conquer', 'C', 'Sorting', 'Heap (Priority Queue)', 'Merge Sort', 'Bucket Sort', 'Python', 'C++', 'Java']