Java | Easy to Understand | 5 lines
 # Intuition  \n\n\n# Approach : PriorityQueue\n- Step 1 : Take one ans array to store the sorted array and PriorityQueue pq. Default PriorityQueue is Min Heap 
<!-- # Intuition -->\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach : PriorityQueue\n- **Step 1** : Take one ```ans``` array to store the sorted array and PriorityQueue ```pq```. Default PriorityQueue is Min Heap , It store all elements in ascending order.\n- **Step 2** : Add all elements in PriorityQueue.\n- **Step 3** : Now add elements of ```pq``` to the ```ans``` array.\n- **Step 4** : Return ```ans``` array.\n \n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] sortArray(int[] nums) {\n\n        int i=0;\n        int[] ans = new int[nums.length];\n        PriorityQueue<Integer> pq = new PriorityQueue<>();\n        for(int num : nums) pq.offer(num);\n        while(!pq.isEmpty()) ans[i++] = pq.poll();\n        return ans;\n    }\n}\n```\n```\nIf you like Please UpVote solution\n```
['Array', 'Sorting', 'Heap (Priority Queue)', 'Java']